i have json object in form :
[ { "id": "458712e247328e4ebfafeb4d922b", "value": [ 1 ], "location": null, "metadata": null, "at": "2015-07-16t16:33:39.113z" }, { "id": "1ghj78d8220734c00ab941f91b14e334b", "value": [ 100 ], "location": null, "metadata": null, "at": "2015-07-16t16:33:26.819z" } ] i want extract "value" (which equals 100 here ) first 1 (and one). how can in node.js?
or obliged convert json string , manipulate it? (with substring example).
thank you
convert json normal javascript object , can use dot notation manipulate our json , again convert resulting javascript object json.
var jsonobj = [ { "id": "458712e247328e4ebfafeb4d922b", "value": [ 1 ], "location": null, "metadata": null, "at": "2015-07-16t16:33:39.113z" }, { "id": "1ghj78d8220734c00ab941f91b14e334b", "value": [ 100 ], "location": null, "metadata": null, "at": "2015-07-16t16:33:26.819z" } ]; var jsobj = json.parse(jsonobj); var resuljsonobj = json.stringify(jsobj[1].value); in case need value :
var value= jsobj[1].value;
Comments
Post a Comment