Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array type attribute comparisons does not return valid results #18

Open
ortzit opened this issue Dec 13, 2021 · 0 comments
Open

Array type attribute comparisons does not return valid results #18

ortzit opened this issue Dec 13, 2021 · 0 comments

Comments

@ortzit
Copy link

ortzit commented Dec 13, 2021

Example:

  lastMetadata := map[string]interface{}{
		  "users": []interface{}{},
	  }
  newMetadata := map[string]interface{}{
	  "users": []interface{}{
		  map[string]interface{}{
			  "foo": "bar",
		  },
	  },
  }
  lastMetadataByte, _ := json.Marshal(lastMetadata)
  newMetadataByte, _ := json.Marshal(newMetadata)
  opt := jsondiff.DefaultJSONOptions()
  opt.SkipMatches = true
  _, resultStr := jsondiff.Compare(lastMetadataByte, newMetadataByte, &opt)

resultStr content (not valid JSON):
{
"users": [
"prop-added":{{}
"prop-added":{"foo": "bar"}
"prop-added":{}}
]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant