[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Recovering the 'document order' of parsed json
Subject: Re: [xsl] Recovering the 'document order' of parsed json From: David Cramer <david@xxxxxxxxxxxx> Date: Tue, 29 Oct 2013 07:23:43 -0500 |
On 10/28/2013 09:05 PM, Liam R E Quin wrote: > On Mon, 2013-10-28 at 20:11 -0500, David Cramer wrote: > >> I'm experimenting with parse-json and the map functions, but I gather >> that once parse-json gives me a map, I have no way of recovering the >> original order of the keys in the source json. > > In general JSON maps are not ordered: > > { "a" : 1, > "socks" : "black" } > is the same as > { "socks" : "black", > "a" : 1 } ... > Hope this helps - if not, maybe send some short/simple test cases? Hi Liam, I had a feeling someone would say that... Sure it's true that json maps are not ordered, but for documentation purposes it is often helpful to present items in a logical order. Consider the code sample in: https://github.com/rackerlabs/otter/blob/master/docbook/src/docbkx/samples/reqCreatePolicy-changePercentAlarm.json When you make the api call, it doesn't matter what order you list name, changePercent, cooldown, type, and args, but for the purposes of documenting the request, starting with "name" will look a lot more natural and logical than starting with "args". Regards, David
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Recovering the 'document , Liam R E Quin | Thread | Re: [xsl] Recovering the 'document , Tony Graham |
Re: [xsl] JSON-encoding strings in , Michael Kay | Date | Re: [xsl] Recovering the 'document , Tony Graham |
Month |