0

I have a question. Maybe someone have an idea. I want to convert a string array with JSON Objects into an array. Like this:

var test = "[{'test1':1,'test2':2},{'test1':1,'test2':2}]";

to:

var test1 = [{'test1':1,'test2':2},{'test1':1,'test2':2}];

my code:

var test = "[{'test1':1,'test2':2},{'test1':1,'test2':2}]";
var array = [];
var array = JSON.parse("[" + test + "]");

But this code don't work.

Do you have any idea?

Thanks for all.

Rob98
  • 37
  • 1
  • 5

0 Answers0