Transforming this JSON via underscore or a javascript utility library? -
i have json looks so:
[{"target": "mydata.12.2", "datapoints": [[763.7, 1368821100], [762.1, 1368821160], [223.11, 1368821220], [886.54, 1368821280], [112.3, 1368821340]]}]
i'd remove first key , surrounding array brackets reads:
{"datapoints": [[763.7, 1368821100], [762.1, 1368821160], [223.11, 1368821220], [886.54, 1368821280], [112.3, 1368821340]]}
my javascript parsing skills leave bit desired , hoping help. perhaps underscore.js has assist here?
no need library. supposing first array called obj1, have do
var obj2 = obj1[0]; delete obj2['target'];
note seem have no json here, plain javascript objects.
supposing want start json , json @ end, parse stringify :
var obj2 = json.parse(json1); delete obj2['target']; var json2 = json.stringify(obj2);
Comments
Post a Comment