cJSON
cJSON copied to clipboard
support for comments
there is many situations need read configure file has annotation i have test the code
char *s = "{//aa \n \"list\":[{\"name\":\"22xiao hong\",\"age\":10},{\"name\":\"33hua hua\",\"age\":\"11\"}]}";
cJSON *root = cJSON_Parse(s);
parse return NULL
Yes, JSON is kind of bad for configuration files because of this. This is why I personally prefer YAML for that, although it requires a much more complex parser.
I can't currently support comments in cJSON, but once #177 is implemented, it could be added as a configuration option.
As comments are not part of the JSON standard, this must be optional.
And if we’re listing ‘favourite configuration format that isn’t JSON’, mine is PSON – PostScript Object Notation (which does support comments!).
As comments are not part of the JSON standard, this must be optional.
This would not be enabled by default of course
Has there been any update on this topic?