0

Hi I'm trying to parse my string to a json object, it wont work, I get a error when I debug the code, Syntax error, here is my variable I want to parse,

var myyVar = "{title: 'myTitle',root: {id:'1',title:'CEO',subtitle:'John Doe',children: [{ id: '2',title: 'COO',subtitle: 'Steve Berman',type: 'staff'},{ id: '3',title: 'CTO',subtitle: 'Mark Claskov',type: 'staff'},]}}"

$.parseJSON(myvar);

I dont get any json objects in return

Any thoughts?

1

Despite the obvious difference in your variable name which I am assuming is a typo - try quoting your key fields. eg:

var myVar = "{'title': 'myTitle'}
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.