Felix,
Pardon me playing devil's advocate a little here, especially since I
suggested a post-processing step that relies on the "feature" you mention ;)
Real world implementations always trump the spec! It talks like a duck!
Your statement seems to show that the ordering information is
intentionally and willfully discarded in the JSON render, because the
render is not implemented in an orderable way. Is that the intention or
is the JSON render duck-ordering just as much as the JS guys?
I'm trying to argue against introducing any meta properties, but if the
order is intentionally discarded, and that information is valuable
(which I think we can agree on) then there definitely should be a way to
obtain that information. A meta property is certainly the simplest way
to do that.
Regards,
Jonathan 'J5' Cook
Felix Meschberger wrote:
Hi,
Edelson, Justin schrieb:
... If a JSON implementation implements objects in a
non-orderable way (which is permitted under the spec and
done in the json.org Java implementation), you can never
recover the original order of child nodes.
The spec is actually very clear: The order amongst properties in objects
is explicitly undefined. That is, code must never expect properties to
have a specific order.
The problem is that browser JavaScript interpreters are implemented
providing a property order, namely the order of property definition
(similar to the ordering of the LinkedHashMap in Java) and client-side
java scripters unfortunately tend to depend on this "feature".
Regards
Felix