Case-Insensitive JSON

Question: How can JSON be processed in a case-insensitive manner?

Rant followed by Answer:  JSON is intended to be case-sensitive.  XML is the same.  Similar to Java, C, C++, etc.  Names are case-sensitive.   Except, of course, there are knuckleheads out there that don’t understand the fundamental specifications and as a result introduce complexity into systems that should never have existed.  Once a feature is added to allow for case-insensitive names, now you have the situation where some systems work whereas others don’t, and to implement JSON just became more complex.  Microsoft does it:     It’s a stupid thing to do.

But… given that the world is prone to stupidity, Chilkat must follow.

The Answer: In v9.5.0.87, Chilkat added the JsonObject property LowerCaseNames:     When the JSON is loaded, the member names are converted to lowercase.  This way you can always use lowercase names and thus the parsing becomes case-insensitive.   (But performance is less impacted because the case conversion only happens once when the JSON is loaded.)


Tags :