Starcounter-Jack / JSON-Patch

Lean and mean Javascript implementation of the JSON-Patch standard (RFC 6902). Update JSON documents using delta patches.
MIT License
1.79k stars 215 forks source link

compare function does not return patches for objects that contain the key "" #260

Open weikinhuang opened 4 years ago

weikinhuang commented 4 years ago

The compare() function does not return any differences when the two objects contain a key {"": ""}.

This data type is used because our PHP backend adds that key to force casting it to a js object in responses, instead of arrays, which is how the PHP json serializer works.

For example:

const foo = { key: { "": "" } };
const bar= { key: { "": "", "bar": "abc" } };
compare(foo, bar);
Starcounter-Jack commented 4 years ago

I will look into this