Extract data from an array in javascript

2

I have an array, and its indexes have a serialized value. I would like to separate these values and put each value in another array (with indices properly separated). Here is my code:

data = ["["RibS7K/JS+ZTYtjDxqh5hg==","lO/CWn5lb3eqCkDhm9PpwA=="]", "["teste a","teste b"]", "[24351,24352]", "["png","png"]", "["teste a","teste b"]", "[7,6]", "[107.0,99.0]"]

newObject.idCrip = data[0];

When I put in newObject.idCrip it gets data[0] , it gets with ["RibS7K/JS+ZTYtjDxqh5hg==","lO/CWn5lb3eqCkDhm9PpwA=="] and not with two separate values and this is disturbing me. Any solution?

    
asked by anonymous 13.05.2014 / 17:16

1 answer

3

I can not say for certain why the code you posted is invalid (missing multiple quotes), but I imagine you're behind it here:

newObject.idCrip = JSON.parse(data[0]);

This works if you have that first array as a string inside the array outside. Missing convert to object.

Demonstration

    
13.05.2014 / 17:24