Skip to content

JSON Difference doesn't work properly when using array of object  #71

@1adityas

Description

@1adityas

I am using JSON Patches (RFC 6902) to get the difference between Jsons in RFC 6902 format
When I am trying to get the differences between two JSONs, that contains Json array and If there happens to be a value or property of an object present in an array that differs between Jsons, the package is returning the address of the whole object instead of pointing to the particular property or value.

for eg:
json1:
{
"names": [
"name1",
"name2",
"name3"
]
}

json2:

{
"names": [
"name11",
"name2",
"name33"
]
}

I get output which points to path ->
path : "/names/2"
operation: remove
path : "/names/1"
operation: remove
path : "/names/0"
operation: remove

And so on...

Whereas I was expecting the output to not point out to 1st index path (i.e. path: "/names/1") as the value is same in both JSON.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions