Skip to content

Possible to specify order of properties? #6

Description

@ThomasDotCodes

Let's say I have the following JSON object:

{
"name" : "John",
"age" : 55,
"sex" : "M"
}

using sortify, of course it will sort them by alphabetical order. However, what if I always wanted the JSON to be exported in the format as above? Is there a way to pass in similar to a whitelist--but have the whitelist retain the order as I enter it?

For example to replicate structure above, the call would be:

JSON.sortify(data, ['name', 'age', 'sex']);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions