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

Doesn't understand insertion/deletion in the middle of a list #47

Open
andreareina opened this issue Apr 28, 2022 · 1 comment
Open

Comments

@andreareina
Copy link

Left: [1,2,3,4]
Right: [1,2,4]

Expected outcome:

  • Missing element 2 from the array on the right side

Actual outcome:

  • Both sides should be equal numbers [ed: element 2]
  • Missing element 3 from the array on the right side
@zgrossbart
Copy link
Owner

Hello @andreareina. Thank you for using JSONDiff.

In this case you have two arrays that look like this:

Element Left Side Right Side
0 1 1
1 2 2
2 3 4
3 4 missing

In this case there are two differences between these two arrays. The first difference is that the second elements have different values: The left-side value is 3 and the right-side value is 4. The second difference is that the right-side array is missing the third value.

This would be a little easier to see if the arrays had different values. Like this:

Left: ["apple", "banana", "orange", "pear"]
Right: ["apple", "banana", "pear"]

Element Left Side Right Side
0 apple apple
1 banana banana
2 pear orange
3 orange missing

In this case the two difference would be:

Both sides should be equal strings

and

Missing element 3 from the array on the right side

Does that help explain what's going on here and why you see two difference instead of one?

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

2 participants