flipkart-incubator / flipkart-incubator/zjsonpatch

bug in replace array in json

Open
#18 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
586
Forks
153
PR merge metrics
No merged PRs in 30d

Description

hi, thanks for this great library.
when I'm getting different between this two jsons

```
"{\"b\": [1,2,4,9]}"
```

and

```
"{\"b\": [6,2,4,9]}"
```

the difference value currectly return operation replace in location 0.

but if I get diff this two jsons

```
"{\"b\": [2,2,5,6]}"
```

and

```
"{\"b\": [4,2,5,6]}"
```

it returns add and remove operation in 0 and 2 positions.
I think the reason of this bug is because of two number 2 .

Contributor guide

Open the contributing guide

Research direction

Reproduce both JSON array examples from the issue and inspect the library's array-diff logic to see how duplicate values affect operation matching. Done means the second example reports the changed value at index 0 as a replace operation, without unrelated add and remove operations at indices 0 and 2.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.