在javascript或jquery中比较json对象的数组

时间:2012-01-02 10:09:53

标签: javascript jquery json

  

可能重复:
  How do you determine equality for two JavaScript objects?

我有两个数组,它持有json对象有没有办法比较这两个数组,如果是的话请回复。

"initial": [

  {
       "level1":10000,
       "level2":20000,
       "increment1":5000,
       "increment2":5000
  },
  {
       "level1":20000,
       "level2":40000,
       "increment1":5000,
       "increment2":6000
  },
  {
       "level1":30000,
       "level2":40000,
       "increment1":10000,
       "increment2":10000
  }

]


"after": [

  {
       "level1":10000,
       "level2":20000,
       "increment1":5000,
       "increment2":5000
  },
  {
       "level1":20000,
       "level2":40000,
       "increment1":5000,
       "increment2":6000
  },
  {
       "level1":20000,
       "level2":50000,
       "increment1":100,
       "increment2":500
  }

]

你可以在数组之后的数组中看到最后一个对象是不同的。

0 个答案:

没有答案