How can I convert a string to object? that is my data :
"({"test1":[{"test2":55,"test":"15.06"},
{"test3":55,"test4":"15.08"}]})"
If you remove the surrounding parentheses, you will get a JSON string, which can be converted to an object using JSON.parse():
var s = '({"test1":[{"test2":55,"test":"15.06"}, {"test3":55,"test4":"15.08"}]})',
j = s.replace(/^\((.+)\)$/, '$1'), //remove surrounding parentheses
o = JSON.parse(j);
console.log(o);
eval() can be dangerous if you don't have control over the string. Otherwise, it should work fine. See stackoverflow.com/questions/86513/…
eval(...)on it. May be also understand the evils of eval.JSON.parse