Compare 2 JSON data?

(Palash Goel) #1

I was working on JSON data. I want to know is there any library which can help me to compare JSON .
Json 1:
Json 2:

Both the JSON are the same, just the index of the objects are different.

(Norbert Melzer) #2

No, the JSONs are different, as in a list order matters.

If your definition of equality is different, you need to implement that on your own.

In go-loke pseudo code it would roughly look like this:

func is_permutation([]map[string]string a, b) bool {
  for _, v := range a {
    if is_member(v, b) {
      delete_element(v, b)
    } else {
      return false
  return true