tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jochen Kemnade (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TAP5-2098) JSONObject should keep its properties in the order in which they were added
Date Fri, 22 Mar 2013 07:53:15 GMT

    [ https://issues.apache.org/jira/browse/TAP5-2098?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13610023#comment-13610023

Jochen Kemnade commented on TAP5-2098:

> I'm not sure what it has to do with pretty printing, 

I'd like to be able to use new JSONObject("{a:1, b:2}").toString(false) and I think it would
be nice to get 
  "a" : 1,
  "b" : 2
in that case, which, at the moment, you don't.

> but we're not going to add new functionality on top of JSON's rather precise specification.

This is not about adding new functionality. I don't want to add an order() method to JSONObject.
Using a LinkedHashMap for the properties, with all the consequences to ordering, is as much
according to the specification as using a HashMap. It's not that you mustn't keep the properties
in the order in which they are added but that you don't have to.
I think a LinkedHashMap-backed JSONObject would behave more like most people would expect.
And I don't see a way to make it behave that way. The properties field is private, the class
is final and I cannot pass a backing map in any of the constructors. Would you be open to
changing any of those limitations?
> JSONObject should keep its properties in the order in which they were added
> ---------------------------------------------------------------------------
>                 Key: TAP5-2098
>                 URL: https://issues.apache.org/jira/browse/TAP5-2098
>             Project: Tapestry 5
>          Issue Type: Wish
>          Components: tapestry-json
>    Affects Versions: 5.3, 5.4
>            Reporter: Jochen Kemnade
>            Priority: Minor
>              Labels: json, patch
> While JSON objects are unordered according to the specification, it would be nice if
Tapestry's implementation kept its properties in the order of their insertion. That way, it
could be used for pretty-printing more easily.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message