I expected the json to not include a property for the shadowed field.
What did you see instead?
The shadowed field was included in the json.
After consideration, I believe the behavior is correct, because it allows the unmarshal case to work as one would expect, but the documentation doesn't lead one to expect the current behavior for marshalling.
The text was updated successfully, but these errors were encountered:
@freeformz I just used the zero values in my example, but your second playground effectively demonstrates the same thing. Notice the properties present in the JSON strings, focusing less on which values are in them. In both my example and your second example, I originally expected the WrapBar json to not include the value property at all. This seems more like a documentation concern than anything else at this point.
The docs seem clear that - kills the current field, not that it kills any other fields.
If you want to kill the embedded value you can do so by making it unavailable by embedding another value at the same depth.