Decodes a patch from a JSON string.
If base is provided, resolves internal IRIs (matching isIRI(value, "internal")) to absolute IRIs using resolve(), recursively throughout the patch structure. Otherwise, performs plain JSON parsing.
base
isIRI(value, "internal")
resolve()
The JSON-serialized Patch
Decoding options
The decoded patch, with resolved IRIs if base is provided
If json is not a string, not a valid Patch, or opts is not a valid CodecOpts
json
opts
decodePatch( '{"vendor":"/vendors/acme","description":null}', { base: "https://example.com/" });// → { vendor: "https://example.com/vendors/acme", description: null } Copy
decodePatch( '{"vendor":"/vendors/acme","description":null}', { base: "https://example.com/" });// → { vendor: "https://example.com/vendors/acme", description: null }
encodePatch
Decodes a patch from a JSON string.
If
baseis provided, resolves internal IRIs (matchingisIRI(value, "internal")) to absolute IRIs usingresolve(), recursively throughout the patch structure. Otherwise, performs plain JSON parsing.