Reputation: 3139
I have receive a string with this format
"{'key': value}, {'key': value},{'key': value} ..."
I need to convert this string to javascript array to use like this:
var $arrayValue = [{'key': value}, {'key': value},{'key': value}];
how to conver this string into array?
Upvotes: 0
Views: 699
Reputation: 107718
string = string = '{"key": "value"}, {"key": "value"}'
JSON.parse("[" + string + "]")
Upvotes: 3