javascript - String to JSON object -
i'm trying convert javascript string value formatted in json syntax, valid json object using json.parse.
// json formatted string var string = "{'1451893035': 1.2,'1452670635':0.5,'1451720235': 2.5}"; // parse json object console.log(json.parse(string)); i'm getting error:
uncaught syntaxerror: unexpected token '
{'1451893035': 1.2,'1452670635':0.5,'1451720235': 2.5} isn't valid json. want:
{"1451893035": 1.2,"1452670635":0.5,"1451720235": 2.5}
Comments
Post a Comment