suppose I have a function:
function getLayerInfo(uuid, top, left, index, pindex) {
this.uuid = uuid;
this.top = top;
this.left = left;
this.index = index;
this.pindex = pindex;
}
then I use json menthod in json.js:
var layer = new getLayerInfo('abc', 123, 456, 4, 5);
var layerjson = layer.toJSONString();
console.log(layerjson );
It have show the correct result,
So if I want restore the json to array or something else,or what should I do?
Or what I want is just need the “index” property value?
What should I do?
Thank you
If your using jQuery do this:
jQuery is recommended because it will use the best and fastest method to parse the JSON string (First trying to run browser parser and then, if unavailable, javascript/built in parsers)
if not using jQuery just run this (it uses browser parser, but be careful with older browsers, make sure it exists):