My asp.net web service has the capability to return a multi-level array.
To parse the json string, I am using the json2.js library :
var data = JSON.parse(msg.d);
The first level of parsing is successful, but the second level array (data) remains as an array of objects
? data[0]
{...}
color: "#0000CD"
data: [[object Object],[object Object]]
label: "formol"
type: "traitement"
? data[0].data
[[object Object],[object Object]]
[0]: {...}
[1]: {...}
? data[0].data[0]
{...}
_l: ""
_x: 7
_y: 25
However, what I actually need is an array of data like this:
? data[0]
{...}
label: "traitement formol 2"
type: "traitement"
color: "#0000CD"
data: [7,25,,7,40,formol]
? data[0].data
[7,25,,7,40,formol]
[0]: [7,25,]
[1]: [7,40,formol]
? data[0].data[0]
[7,25,]
[0]: 7
[1]: 25
[2]: ""
Can anyone suggest the best approach to decode/parse all levels of the json string at once?
Thank you.