In the patch pre-transformed spec logic, when a JSON object is replaced by an array, it could sometimes happen that the result would be an object with integer keys (e.g. {"0": "A", "1": "BB"} instead of an array (e.g. ["A", "BB"]). I think this is a natural consequence of how JSON patching works, so I don't think it's necessarily a bug in json-patch.
This PR identifies such objects and converts them to proper arrays.
In the patch pre-transformed spec logic, when a JSON object is replaced by an array, it could sometimes happen that the result would be an object with integer keys (e.g.
{"0": "A", "1": "BB"}
instead of an array (e.g.["A", "BB"]
). I think this is a natural consequence of how JSON patching works, so I don't think it's necessarily a bug in json-patch.This PR identifies such objects and converts them to proper arrays.