jsonyx.apply_patch

jsonyx.apply_patch(obj, patch, *, allow=NOTHING, use_decimal=False)[source]

Apply a JSON patch to a Python object.

Added in version 2.0.

Parameters:
Raises:
Returns:

Any – the patched Python object

Example:
>>> import jsonyx as json
>>> json.apply_patch([1, 2, 3], {"op": "del", "path": "$[1]"})
[1, 3]

Tip

Using a filter instead of an index is more robust.