Retire las cortes de JSON PHP
json_decode($val, true, JSON_UNESCAPED_SLASHES);
MD Rashid
json_decode($val, true, JSON_UNESCAPED_SLASHES);
echo stripslashes('{\"test\":{\"test1\":{\"test1\":[{\"test2\":\"1\",\"test3\": \"foo\",\"test4\":\"bar\",\"test5\":\"test7\"}]}}}');
var finalData = str.replace(/\\/g, "");