I am trying to prepare Json Object in Swift
[
{
"property1": val1,
"property2": val2,
"property3": val3
},
{
"property1": val1,
"property2": val2,
"property3": val3
},
{
"property1": val1,
"property2": val2,
"property3": val3
}
]
But when seing request the objects order is changed for array
[
{
"property1": val1,
"property2": val2,
"property3": val3
},
{
"property1": val1,
"property3": val3,
"property2": val2
},
{
"property3": val3,
"property2": val2,
"property1": val1
}
]
How can we change same order for object in Swift.
A dictionary is simply a container that can hold multiple data as key-value pair in an unordered way. so your JSON object always will be unordered.
but You can get in order if you retrieve it with key-value pair.