You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Stefan Seifert (JIRA)" <ji...@apache.org> on 2017/02/20 22:08:44 UTC

[jira] [Resolved] (FELIX-5556) JSONParser does not retain object order

     [ https://issues.apache.org/jira/browse/FELIX-5556?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Seifert resolved FELIX-5556.
-----------------------------------
    Resolution: Fixed

Completed: At revision: 1783803  


> JSONParser does not retain object order
> ---------------------------------------
>
>                 Key: FELIX-5556
>                 URL: https://issues.apache.org/jira/browse/FELIX-5556
>             Project: Felix
>          Issue Type: Bug
>          Components: Utils
>    Affects Versions: utils-1.9.0
>            Reporter: Stefan Seifert
>            Assignee: Stefan Seifert
>             Fix For: utils-1.9.2
>
>
> the {{JSONParser}} does not retain the order of objects the JSON files it parses. the order is randomly based on the HashMap implementation used internally.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Re: [jira] [Resolved] (FELIX-5556) JSONParser does not retain object order

Posted by Felix Meschberger <fm...@adobe.com>.
Hi all

I think this is a very bad idea !

According to RFC 4627 [1]:

> An object is an unordered collection of zero or more name/value
> pairs, where a name is a string and a value is a string, number,
> boolean, null, object, or array.

Parsing the JSON and then storing in a defined order creates expectations which are not valid. There is no defined order amongst properties in an object and we must not create the impression that there would be and even start having applications depending on it.

Therefore I strongly suggest to revert this change and go back to using a HashMap.

Regards
Felix

[1] https://www.ietf.org/rfc/rfc4627.txt

> Am 20.02.2017 um 23:08 schrieb Stefan Seifert (JIRA) <ji...@apache.org>:
> 
> 
>     [ https://issues.apache.org/jira/browse/FELIX-5556?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
> 
> Stefan Seifert resolved FELIX-5556.
> -----------------------------------
>    Resolution: Fixed
> 
> Completed: At revision: 1783803  
> 
> 
>> JSONParser does not retain object order
>> ---------------------------------------
>> 
>>                Key: FELIX-5556
>>                URL: https://issues.apache.org/jira/browse/FELIX-5556
>>            Project: Felix
>>         Issue Type: Bug
>>         Components: Utils
>>   Affects Versions: utils-1.9.0
>>           Reporter: Stefan Seifert
>>           Assignee: Stefan Seifert
>>            Fix For: utils-1.9.2
>> 
>> 
>> the {{JSONParser}} does not retain the order of objects the JSON files it parses. the order is randomly based on the HashMap implementation used internally.
> 
> 
> 
> --
> This message was sent by Atlassian JIRA
> (v6.3.15#6346)