2 ms·
as in `{null:null}` ? won't that set a field called 'null', to the value null?
by chii 5y ago
as in `{null:null}` ?
won't that set a field called 'null', to the value null?
- jayd16 5y agoAs in { "foo" : null } You can interpret a null field the same as a missing field. You only need to worry if you have arbitrary dictionary keys and need to differentiate a null value from an missing key.
- rrrhys 5y agoNull could imply the field was present and a value not entered or not necessary. Missing could imply the field was never known about at all. The context is important. Null != missing.
- masklinn 5y ago> You can interpret a null field the same as a missing field. Not in the general case no, they are two different states, which may have entirely different semantics. For instance a missing field can mean "don't touch this field" while a field set to null means "set this field to null". Some schemas might opt to ignore this distinction and collapse the states, but that is a specific decision, and an express loss of information. > You only need to worry if you have arbitrary dictionary keys and need to differentiate a null value from an missing key. There are other situations where that's an issue, like the above, or when you're using the object as a set (which JSON doesn't have), or when you've defined the schema to never have missing fields (but possibly have some set to `null`) so clients will break, ...