javascript - Convert JSON to java script -


can provide java script below json. tried in many way, not add field "set"

{    "student":[       "set",       [          {             "name":"abcd",             "id":"1234"          }       ]    ] } 

so javascript variable objecthaving property/key name student of array type. student has 2 elements set string , object, other element array, has element of object type. element has 2 properties/keys name , id.

var required = {};          required.student = [];          required.student.push("set");          var innerarray = [];          var innerobj = {};          innerobj.name = "abcd";          innerobj.id = "1234";          innerarray.push(innerobj);          required.student.push(innerarray);        document.write('<pre> ' + json.stringify(required,0, 3) + '</pre>');


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -