NSJSONSerialization should be able to maintain dictionary key order

Originator:davbeck
Number:rdar://19716062 Date Originated:04-Feb-2015 09:42 AM
Status:Open Resolved:
Product:iOS SDK Product Version:8.1
Classification:Enhancement Reproducible:Always
 
Summary:
JSON dictionaries have an implicit order to their keys. However, when converted to NSDictionary the keys are hashed and ordered for performance. While this is good default behavior, it makes some tasks impossible to use NSJSONSerialization for.

Foundation should include an ordered dictionary type that developers can pass in to NSJSONSerialization that will be encoded with the correct order it was created with. Likewise, there should be a reading option that causes NSJSONSerialization to return that same ordered dictionary with the order the JSON file uses.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!