Order of keys is not predictable and neither the client side nor the
server side should care (though I realize this can cause some hiccups
when testing!).

Order of items within a JSON array are in the order they are added.

On Mon, Nov 30, 2009 at 4:35 PM, Marcel Sammut <[email protected]> wrote:
>
> Greeting,
> Is it possible to create JSON objects (JSONObject, JSONArray) where the
> order of items in the list is preserved by the order they are entered?
>
> Why does JSONOArray return a pair of key and name entries in a different
> order then it was originally created?
>
> For Example:
> JSONObject response = new JSONObject();
> response.put("success", true);
> response.put("total", 50);
> response.put("metaData", new JSONArray()...);
> response.put("records", new JSONArray()...);
> response.put("columns", new JSONArray()...);
>
> The above returns a JSON formatted string:
> {"total":50,"columns":[{...}],"records":[{...}],"success":true,"metaData":{...},{...},{...},{...}]}}
>
> The order of the output is unpredictable.  Is there a way to have the
> Tapestry JSON objects maintain the order of their lists (via LinkedHashMap
> for example?)?
>
> Thanks,
> Marcel
> --
> View this message in context: 
> http://old.nabble.com/T5-JSON-Preserving-Order-tp26584717p26584717.html
> Sent from the Tapestry - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to