sort keys with JSON.stringify()
Felipe Gasper
felipe at felipegasper.com
Mon Sep 12 08:10:38 PDT 2011
On 9/12/11 10:07 AM, Brian Kardell wrote:
> But Doug, just to clarify: You mean that the parsed objects create no
> predictable insertion order right? It is actually possible to use
> replacer to serialize keys in a particular order, and that might be
> enough for what he is looking for (if two objects serialized as the same
> string they would be equal).
Almost. Actually, I want the converse: if two objects are equal, they
serialize the same way.
I noodled with the replacer function for a bit but wasn’t able to get
something that seems to work for objects of arbitrary depth.
-FG
More information about the es-discuss
mailing list