libfastjson
libfastjson copied to clipboard
think about the "null" object representation
currently (inherited from json-c), the null object is implemented differently from any other objects. It's not a struct json_object (ptr), but rather C NULL
. This is inconsistent, and causes some trouble with the API (e.g. json_object_object_get()
, which was deprecated for that reason). This also means that all callers need to handle the null object differently.
We should at least consider the represent the null object differently. A natural choice would be to do it just like with any other object with only the type set to fjson_type_null
.
see also https://github.com/json-c/json-c/issues/226
I strongly recommend that JSON "null" will not be represented as C NULL. They are semantically different things. Keeping it C NULL will perpetuate all the regular problem that come from semantic misrepresentation: more code and more convoluted code to handle that object.