私は、階層構造を持つ2つのオブジェクトJSONを持っています。 JSONの行セット内の各オブジェクトを比較する必要があります。そして、どこで値が等しくないgettng 次に、私は対応するオブジェクトに1つのフラグを追加する必要があります。AngularJsを使用して2つのオブジェクトJSONを比較するにはどうすればよいですか?
私のJSONを見て、解決策を教えてください。少なくとも角度のない場合は、私はJavascriptで達成する必要があります。事前に
おかげで...
JSON1
{"entityinfo":{"entity":"Customer29Jan16","tenantid":"292FEC76-5F1C-486F-85A5-09D88096F098","timestamp":"2015-12-15T10:16:06.322Z"},"collections":{"Customer29Jan16":{"rowset":[{"CuId":"123","Name":"Ranjini","Quantity":"60","Rate":"60","Amount":"3600"}],"meta":{"parentreference":"***","pkname":"***","fkname":"***"},"rowfilter":[]},"Customer29Jan16Obj":{"rowset":[{"CuObjId":"456","FullAddress":"Electronic City","ObjAddr":"Bangalore","ObjName":"Testing"}],"meta":{"parentreference":"***","pkname":"***","fkname":"***"},"rowfilter":[]}}}
JSON2
{"entityinfo":{"entity":"Customer29Jan16","tenantid":"292FEC76-5F1C-486F-85A5-09D88096F098","timestamp":"2015-12-15T10:16:06.322Z"},"collections":{"Customer29Jan16":{"rowset":[{"CuId":"123","Name":"Vijay","Quantity":"60","Rate":"60","Amount":"3600"}],"meta":{"parentreference":"***","pkname":"***","fkname":"***"},"rowfilter":[]},"Customer29Jan16Obj":{"rowset":[{"CuObjId":"456","FullAddress":"SilkBoard","ObjAddr":"Bangalore","ObjName":"Testing"}],"meta":{"parentreference":"***","pkname":"***","fkname":"***"},"rowfilter":[]}}}
あなたは、対応するオブジェクトにフラグを追加することによって何を意味するのですか? –
2つのオブジェクトを 'angular.equals(obj1、obj2);'で比較できます。 – Arg0n
[角でオブジェクトを比較]の複製があります(http://stackoverflow.com/questions/20409712/compare-objects-in-angular) – JrBenito