JsonPatch(json, json)

From NWN Lexicon
Jump to: navigation, search
Nwnee logo.jpg Note: This article documents Neverwinter Nights: Enhanced Edition new content or changes/updates/fixes to 1.69 functions. These are all listed under the category and patches pages.

Returns a modified version of jData patched by jPatch, according to the rules described below.

json JsonPatch(
    json jData,
    json jPatch
);


Parameters

jData
json data to patch
jPatch
a json array of patch elements to apply to jData


Description

Returns a modified version of jData patched by jPatch, according to the rules described below.


Remarks

See JsonPointer for documentation on the pointer syntax.

Returns a json null value on error, with JsonGetError filled in. jPatch is an array of patch elements, each containing a op, a path, and a value field. Example:

[
  { "op": "replace", "path": "/baz", "value": "boo" },
  { "op": "add", "path": "/hello", "value": ["world"] },
  { "op": "remove", "path": "/foo"}
]

Valid operations are: add, remove, replace, move, copy, test

See RFC7386 for details on the patch rules.

Version

This function was added in 1.85.8193.31 of NWN:EE.


Example

Information icon.png This article is in need of examples. You can help the NWN Lexicon by showing how to use this code effectively.


See Also

functions:

JSON Functions