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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -