I have an object like this
var obj = {
'Lorem': 'foo',
'Ipsum[0]': 'bar',
'Ipsum[1]': 'stuff',
'Dolor[0][0]': 'foo',
'Dolor[0][1]': 'bar',
'Dolor[1][0]': 'stuff',
'Dolor[1][1]': 'foo'
};
And I'd like to turn it into this
var obj = {
'Lorem': 'foo',
'Ipsum': ['bar', 'stuff'],
'Dolor': [
['foo', 'bar'],
['stuff', 'foo']
]
};
I dug up from here that with .match(/[^\[\]]+/g)
I can get the values between the brackets, but I can't figure out what to do with them.