javascript - Convert dynamic string to JSON object -


I need some help in changing JSON strings in JSON objects. Here's my variable:

  var myString = "{title: 'mySchema'," + "root: {id: '" + var1 + "', '+' Title: '" + Var2 + "'," + "Subtitle:'" + var3 + "',' ChildVar = myString +" {id: '"+ var1 +"', '+' Title: '"+ var2 +"', " MyString = getChildNodes (task entries, head, liststrings); MyString = myString + "},";} myString = "" MyString + "]}}";} MyString = kidsVar; MyString = kidsVar; JSON.stringify (myString); $ .parseJSON (myString);  

This myString Output is when I debug:

  {title: 'mySchema', root: {id: 1, title: 'OOB', subtitles: 'hang chaw', children: [ ID: '2', Head Usher: 'OAK', Subtitle: 'Man', Type: 'VA'}, {ID: 3 ', Title:' OOB ', Subtitle:' Hung Aslave ', type:' VA '},]}};  

Delete the last comma before the closed array (.)

< / Div>

Comments