Status/Resolution/Reason: Closed/Withdrawn/NotABug
Reporter/Name(from Bugbase): Martin Parry / Martin Parry (Martin Parry)
Created: 09/20/2015
Components: Language, Serialization
Versions: 11.0
Failure Type:
Found In Build/Fixed In Build: CF11_Final /
Priority/Frequency: Major / All users will encounter
Locale/System: English / Windows 10 64 bit
Vote Count: 0
When deserializing a JSON object the elements withing the object are sorted alphabeticall instead of maintaing the correct order.
I am using Alpaca form builder ( http://www.alpacajs.org/demos/form-builder/form-builder.html ) to design forms for use within our app - Alpaca exports the JSON with the correct order of the fields I have created. e.g. first name, middle names and last_name. You can check out the JSON by clicking on the code tab.
After deserializing, the order of the fields are in alphabetical rather than the correct order I have drag and dropped them into. Thus, when presenting the user with the form to fill in, the fields are not in the correct order.
The result after deserializing the above object is in the attachments >>>>
To reproduce:-
<cfsavecontent variable="theJSON">
{
"schema": {
"required": false,
"type": "object",
"properties": {
"_en_first_name": {
"required": false,
"type": "string",
"properties": {}
},
"_en_middle_names": {
"required": false,
"type": "string",
"properties": {}
},
"_en_last_name": {
"required": false,
"type": "string",
"properties": {}
}
}
},
"options": {
"disabled": false,
"collapsible": true,
"legendStyle": "button",
"helpers": [],
"focus": false,
"showMessages": true,
"validate": true,
"type": "object",
"fields": {
"_en_first_name": {
"attributes": {},
"renderButtons": true,
"autocomplete": false,
"disallowEmptySpaces": false,
"disabled": false,
"data": {},
"helpers": [],
"disallowOnlyEmptySpaces": false,
"showMessages": true,
"label": "First name",
"validate": true,
"type": "text",
"allowOptionalEmpty": true,
"fields": {}
},
"_en_middle_names": {
"attributes": {},
"renderButtons": true,
"autocomplete": false,
"disallowEmptySpaces": false,
"disabled": false,
"data": {},
"helpers": [],
"disallowOnlyEmptySpaces": false,
"showMessages": true,
"label": "Middle name(s)",
"validate": true,
"type": "text",
"allowOptionalEmpty": true,
"fields": {}
},
"_en_last_name": {
"attributes": {},
"renderButtons": true,
"autocomplete": false,
"disallowEmptySpaces": false,
"disabled": false,
"data": {},
"helpers": [],
"disallowOnlyEmptySpaces": false,
"showMessages": true,
"label": "Last Name",
"validate": true,
"type": "text",
"allowOptionalEmpty": true,
"fields": {}
}
}
},
"data": {}
}
</cfsavecontent>
<cfdump var="#deserializeJSON(theJSON)#" label=" "><cfabort>
Any Workarounds:
Not that I'm aware of
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 4060037
External Customer Info:
External Company:
External Customer Name: Martin Parry
External Customer Email:
External Test Config: Not relevant
Attachments:
- September 20, 2015 00:00:00: 1_json.png
Comments: