I have this json object that hold some data, and I'm doing a search on that object and when the result match I want to save it to another object. What is the best way to do it.
I need some help copying the data I want to the new variable.
Here is what I have.
myjson = JSON.parse(jsonData);
for(var x=0; x<myjson.ROWCOUNT;x++){
if(myjson.DATA.PARTNUMBER[x].search(regex) != -1){
console.log(myjson.DATA.PARTNUMBER[x]);
}
}
Where I have the console.log that display the partnumber, how can I make it so it copies all the content from the X row?
myjson has 4 columns (ID,PARTNUMBER,DESCRIPTION,PRICE) but I'm only searching on the partnumber. I need to copy all to the new json object.
thanks.