Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

make the json object ordered#200

Closed
johnscancella wants to merge 1 commit intostleary:masterfrom
johnscancella:master
Closed

make the json object ordered#200
johnscancella wants to merge 1 commit intostleary:masterfrom
johnscancella:master

Conversation

@johnscancella
Copy link

If you use a linkedHashMap instead of just hashMap you can easily make it ordered. I work on https://github.com/LibraryOfCongress/bagger which needs the JSONObject to preserve the ordering of the fields.

@erosb
Copy link
Contributor

erosb commented Feb 17, 2016

The object ordering has already been discussed in #190 and has been rejected for 2 reasons:

  • the json specification says that objects are unordered, and this library shouldn't go against it
  • switching to LinkedHashMap would cause serious performance problems for larger objects, since the lookup (JSONObject.opt(key)) is expensive

@stleary
Copy link
Owner

stleary commented Feb 18, 2016

Thanks, but can't accept this change. If you really need ordered JSONObjects, you might want to fork the project. A Library of Congress project sounds pretty cool, good luck!

@stleary stleary closed this Feb 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants