I'm dealing with a unique object structure that behaves similarly to an array, except it contains a mix of index types (numbers and strings). Here's an example:
var myObj = [];
myObj[0] = 'a';
myObj[1] = 'b';
myObj[2] = 'c';
myObj['x'] = 'y';
When I use JSON.stringify()
on it and then parse it back using JSON.parse()
, the part where I assign myObj['x'] = 'y';
seems to disappear. I'm looking for a solution to retain this data. Any suggestions?