Jsonlint display that this JSON object is valid:
[{"obj":{"markers":"[{\"k\":47.040182144806664,\"B\":0.52734375},{\"k\":50.90303283111257,\"B\":10.37109375},{\"k\":52.53627304145945,\"B\":-1.7578125},{\"k\":41.77131167976406,\"B\":-6.591796875}]","path":"[[47.040182144806664,0.52734375],[50.90303283111257,10.37109375],[52.53627304145945,-1.7578125],[41.77131167976406,-6.591796875]]"}}]
I'm trying to access to markers with the k, B and path elements but it's always set to undefined. Here is my code:
try {
var jsonData = JSON.parse(myJson);
console.log(jsonData.obj[0].markers[0].k);
}
catch (e) {
console.error("Parsing error:", e);
}
Can someone tell me how to access to the element of my JSON object properly? Thanks for the help.
objis an object, not an arrayk:\"k\"is not an index - it's a value of themarkersindex.