Json select a specific item out for editing with javascript
- by minus4
I have the following JSon:
{"DPI":"66.8213457076566",
"width":"563.341067",
"editable":"True",
"pricecat":"6",
"numpages":"2",
"height":"400",
"page":[{"filename":"999_9_1.jpg",
"line":[{"test":"test 1",lineid:22},
{"test":"test 2",lineid:22},
{"test":"test 3",lineid:22},
{"test":"test 4",lineid:22},
{"test":"blank",lineid:22}]},
{"filename":"999_9_2.jpg",
"line":[]}]}#
i can do most things with lines like
measurements.page[0].line[0].lineid;
but what i am really stuck with is when i want to edit a specific line but i only have lineid available and not the line number
in the array, for example:
measurements.page[0].line[0].test = "new changed value";
however i dod not know the line number I.E 0 line[0]
is there a way for me to get the line number of a line that has a lineid value of say 22 ????
and all within javascript
thanks