New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to return objects as Maps to support ordered properties #207
Comments
You bring up some very interesting points, but are you sure you're posting in the right place. This is the repository for JSON5, a version of JSON that's easier for humans to read and write, but you don't mention JSON5 in your post anywhere. That being said, it might be interesting to include an option in this library that returns a |
Thank you for your reply. Sorry that I might post the question in the wrong place. I thought JSON5 is improved JSON, I might have misunderstood the purpose of JSON5 library, maybe JSON5 is more about easier configuration purpose, I guess. It is great If I have an additional type |
I'd also like to request the option to preserve the order with This is useful when deriving locale files with string IDs from a main locale file and you want changes like reordering strings or inserting a new string in a specific context to be transferred to the derived files. If this feature becomes available, editing software like translation webapps could also start to uphold the order. |
Reopening this issue to accommodate more discussion. |
|
I understood that the json object is designed to be unordered, and json arrays will preserve order. So if I would like to preserve the order , then I should use list instead of object, but it is not convenient if I have an
OrderedDictionary
in the backend.Now I am using c# for backend, in c#, it has
OrderedDictionary
which will preserve the order. After I marshal theOrderedDictionary
to json, the order will be lost. When I debug the code, I found theOrderedDictionary
was totally fine , the only problem was JSON changed the order of the key.After I google about how to solve the problem, I realized that I am not the only one who asked about how to keep the order of keys in json object. Most backend languages have something similar to
OrderedList
, when they marshal to json , they have the same problems, and all the solutions say that we should use array instead of object.Can we have a new type of object to keep the order of the keys so that the
OrderedDictionary
can marshal to json with preserved order? Thanks.The text was updated successfully, but these errors were encountered: