
Davide Bolcioni wrote:
On Sunday 21 December 2008 11:49:05 am Kirit Sælensminde wrote:
Judging by the documentation[1] the parser seems to target a different use case. Mine includes a full JSON object, rather than the only partially compatible property tree -- for example, mine won't lose null, true or false type information (so can write back out the exact equivalent JSON after it has been parsed).
Not having downloaded the code ... would it preserve comments or could it be easily extended in order to preserve comments ?
It does not preserve comments, in fact it will throw a parse error if comments are encountered. I guess JavaScript style comments are an obvious extension, but I can't see that they are part of the standard. I can't help but think that trying to store comments with the the rest of the representation is anything other than opening a can of worms. If the JSON is processed then output again what happens to comments? It seems to me that the preservation of comments is going to be hard without a load of examples and use cases, and even then is it going to be worth it? Not sure, but for what I use JSON for (mostly web services) I can't see it. That the parser should skip comments that it finds I guess there could be a argument for. K