Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

JSON.MergePatch.FromDiff

Create a JSON Merge Patch from a diff of two json documents.

Component Version macOS Windows Linux Server iOS SDK
JSON 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "JSON.MergePatch.FromDiff"; json1; json2 )   More

Parameters

Parameter Description Example
json1 A JSON text or reference.
json2 A JSON text or reference.

Result

Returns JSON or error.

Description

Create a JSON Merge Patch from a diff of two json documents.
Returns a JSON Merge Patch.
The mergepatch function implement the IETF standard JSON Merge Patch.

Use JSON.MergePatch.ApplyPatch to apply the patch to JSON data later.

Examples

Create a patch:

MBS( "JSON.MergePatch.FromDiff";
"{\"people\":[{\"first\":\"Christian\",\"last\":\"Miller\",\"city\":\"Nickenich\"}]}";
"{\"people\":[{\"first\":\"Peter\",\"city\":\"Nickenich\", \"zip\": 56645 }]}" )

Example result:
{ "people": [ { "first": "Peter", "city": "Nickenich", "zip": 56645 } ] }

See also

Release notes

Blog Entries

This function checks for a license.

Created 23th November 2023, last changed 23th November 2023


JSON.MergePatch.ApplyPatch - JSON.Parse