I have a string like this one:
{
"products":{"56":"productName","28":"productName"},
"excludedProducts":{"83":"productName","1":"poductName"}
}
So what I want is to get an object in javascript which looks like this:
{
products: {
"56": "productName",
"28": "productName"
},
excludedProducts: {
"83": "productName",
"1": "productName"
}
}
But JSON.parse() converts numbers into indexes and I get
{
products: {
28: "productName",
56: "productName"
},
excludedProducts: {
83: "productName",
1: "productName"
}
}
So basically, is there a way to preserve order of elements after parsing the string formatted like that?