Possible Duplicate:
How can I interpret a JSON object received as a string correctly?

I have an array of arrays which I have planted in the DOM, so that I can reuse it at a later stage to transfer to the server:

[["1","aaaaaa","1"],["2","bbbbbbb","2"],["3","ccccccc","3"]]

If I would like to convert it back into a Javascript array, how would I go about doing this?

Any help appreciated...

share|improve this question
1  
That's not JSON. That already is an array. – Diodeus Feb 23 '12 at 20:19
@Diodeus: "...which I have planted in the DOM..." I'm guessing OP is showing text content that is hidden somewhere in the page. – am not i am Feb 23 '12 at 20:20
1  
how nice to see all the 10k rep member jumping to get more reputation ... – tereško Feb 23 '12 at 20:22
2  
@tereško: I don't think that's a duplicate. Seems that OP is going the other direction. – am not i am Feb 23 '12 at 20:23
1  
@amnotiam you're correct, found a correct duplicate – jondavidjohn Feb 23 '12 at 20:25
show 1 more comment

marked as duplicate by tereško, jondavidjohn, Neal, Esailija, Incognito Feb 23 '12 at 20:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4 Answers

up vote 9 down vote accepted
var obj = $.parseJSON('[["1","aaaaaa","1"],["2","bbbbbbb","2"],["3","ccccccc","3"]]')

Assuming jquery is ok to use because of tag.

share|improve this answer

If the browzer has the JSON object then

JSON.parse(string);

or if you have jQuery

$.parseJSON(string);
share|improve this answer
var array = JSON.parse(my_JSON)
share|improve this answer

jQuery.parseJSON()

var myArr = $.parseJSON(myJsonString);
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.