I am just getting started with this so I am confused about how I would work with the following.
// so I believe this really isn't an object just a string representation, but for example please excuse the name
var dataObj = "{'id': 1,
'data': { 'color': 'red',
'shape' : 'triangle',
'height' : 100,
'width' : 45,
},
'id': 2,
'data': { 'color': 'blue',
'shape' : 'square',
'height' : 75,
'width' : 67,
},
'id': 3,
'data': { 'color': 'orange',
'shape' : 'circle',
'height' : 89,
'width' :24,
}
}";
so what I am having problems with is how would I update specific subset of the data values by the id (like a SQL UPDATE WHERE kind of thing)? javascript or jquery really doesn't matter to me, just don't know an approach for either.
dataObjUpdate(2);
function dataObjUpdate (passedID) {
//access the data by the passedID match and update the color to black
}
appreciate the help guys....
idproperty occurs multiple times in the serialized object. I think you might want to change to an array of objects, instead of this one object.