Hi Carl, Carl Hall schrieb: > I'm just getting into Sling and am starting to port code over that > interacts with JSON. I found the commons.json bundle but am wondering > why Sling implements these functions itself instead of using something > like json-lib?
Our commons.json is basically the same as the Java JSON library from json.org. We added a new JsonWriter and we also "enhanced" the JsonObject class to ensure property order. Re property order: We know, that the ECMAScript spec explicitly states, that properties of an object have no defined order. On the other hand every browser known on the planet (at least the big ones Firefox and Internet Explorer) actually have ordered properties: the order is the order of adding the properties to the object. We reckon that this has (unfortunately IMHO) become a situation, that some developers have become to depend on ... So we modified the JsonObject class. We also tried to convince Douglas Crockford to adapt his original JsonObject class, but he refused referring to the ECMAScript spec. So we decided to fork and adapt our own copy. Hope this helps. Regards Felix
