/* Find records in a field from a JSON array inarray data list fieldname field name Fieldvalue field value out find the data list */var Searchrecordsfromjsonarra y = function (array, fieldName, fieldvalue) {var result = []; if ($.isarray (array)) {for (var i = 0; i < Array.Length; i++) {var rowitem = array[i]; For (var item in Rowitem) {if (item = = FieldName && Rowitem[item] = = Fieldvalue) { Result.push (Rowitem); }}}} return result; /* Modify the value of a record according to a field if it does not match the corresponding record, do not update the list of data inarray to update record new records fildname field name outarray Updated data list * /var Updaterecordbykey = function (array, record,fieldname) {if ($.isarray (array)) {for (var i = 0; i < arr Ay.length; i++) {var rowitem = array[i]; For (var item in Rowitem) {if (item = = FieldName && Rowitem[item] = = Fieldvalue) { Updates the matching record for (Var ri in Rowitem) {for (Var r in record) {if (ri = = r) { Rowitem[ri] = Record[r]; }}}}} Array[i] = Rowitem; }} return array;}
Look for all loops, to be improved
JSON list Data Lookup update