-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Summary
I'm not sure if this is possible, but being able to preserve the JSON key order to exactly match the source .json files would make a huge improvement to legibility, consistency, and easier to follow documentation.
Detailed Description
Currently, when you create a .json document which will be exported by cbswagger, the resulting JSON file struct key order appears to be random.
For example, in this schema json file example:
{
"type": "object",
"properties": {
"address": {
"type": "string"
},
"city": {
"type": "integer"
},
"state": {
"type": "integer"
},
"zip": {
"type": "integer"
}
}
}
When processed by cbswagger, results in the final JSON looking like this:
{
"type": "object",
"properties": {
"zip": {
"type": "integer"
},
"city": {
"type": "integer"
},
"address": {
"type": "string"
},
"state": {
"type": "integer"
}
}
}
Possible Implementation Ideas
I know ColdFusion has the ability to preserve struct order by using a Java LinkedHashMap, which works a lot like structs. Perhaps the JSON struct conversion could be done using a Java-based JSON parser which uses hash maps, so the resulting order is preserved in the final output.