-
Notifications
You must be signed in to change notification settings - Fork 42
Closed
Description
json1 := []byte(`{"a": { "b": [ {"c": [3,2]}, 2, 1 ]}}`)
json2 := []byte(`{"a": { "b": [ {"c": [2,3]}, 1, 2 ]}}`)
patch, err := jsondiff.CompareJSON(json1[:], json2[:], jsondiff.Equivalent())
if err != nil {
fmt.Println(fmt.Errorf("compare: %w", err))
}
b, err := json.MarshalIndent(patch, "", " ")
if err != nil {
fmt.Println(fmt.Errorf("marshal indent: %w", err))
}
os.Stdout.Write(b)
result is:
[
{
"value": 1,
"op": "replace",
"path": "/a/b/1"
},
{
"value": 2,
"op": "replace",
"path": "/a/b/2"
}
]
I expect to have no difference
Metadata
Metadata
Assignees
Labels
No labels