zjsonpatch icon indicating copy to clipboard operation
zjsonpatch copied to clipboard

JsonDiff bug found

Open fmoghaddam opened this issue 5 months ago • 0 comments

Expected Behavior

Source:

{
    "store": {
        "a": [
            "v1",
            "v2"
        ]
    }
}

Target:

{
    "store": {
        "a": []
    }
}

running JsonDiff.asJson(source, target) should return:

[
    {
        "op": "remove",
        "path": "/store/a/0",
        "value": "v1"
    },
    {
        "op": "remove",
        "path": "/store/a/1",
        "value": "v2"
    }
]

Actual Behavior

But returns:

[
    {
        "op": "remove",
        "path": "/store/a/0",
        "value": "v1"
    },
    {
        "op": "remove",
        "path": "/store/a/0",
        "value": "v2"
    }
]

Steps to Reproduce the Problem

running JsonDiff.asJson(source, target)

Specifications

Maven Windows

Library Version: 0.4.16 Language (e.g. Java 1.8, Scala, etc): Java 17

fmoghaddam avatar Oct 01 '24 11:10 fmoghaddam