3 ms·
To me the "NULL" of JSON is really the lack of a value. I think having a NULL value could introduce problems. For example: Did you set `{"address":null}` or di
by bArray 6y ago
To me the "NULL" of JSON is really the lack of a value. I think having a NULL value could introduce problems.
For example: Did you set `{"address":null}` or did you set `{"address":0x00000000}`? It's important to know the difference, do you need to throw an error or warning? If your NULL value maps to something that is also valid input, how are you supposed to know how to handle the case? If you removed the "address" key on the other hand, you can simply do some exists() functions check.
I think putting types into the JSON spec only serves to create confusion. I think the JSON libraries should offer common helper functions for doing these conversions (e.g. string -> int), but ultimately it's the responsibility of the coder.