Reputation: 1183
I'm trying to convert a JavaScript string whose value is already formatted in JSON syntax, to a valid JSON object using JSON.parse
.
// JSON formatted string
var string = "{'1451893035': 1.2,'1452670635':0.5,'1451720235': 2.5}";
// parse to JSON object
console.log(JSON.parse(string));
I'm currently getting this error:
Uncaught SyntaxError: Unexpected token '
Upvotes: 0
Views: 71