Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
JSON.MergePatch.ApplyPatch
Applies a merge patch to a json document.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
JSON | 14.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
json | A JSON text or reference. | |
jsonPatch | A JSON text or reference. |
Result
Returns JSON or error.
Description
Applies a merge patch to a json document.The mergepatch function implement the IETF standard JSON Merge Patch.
Examples
Try it:
Let ( [
json1 = "{\"people\":[{\"first\":\"Christian\",\"last\":\"Miller\",\"city\":\"Nickenich\"}],\"id\":1}";
json2 = "{\"people\":[{\"first\":\"Peter\",\"city\":\"Nickenich\", \"zip\": 56645 }]}";
patch = MBS( "JSON.MergePatch.FromDiff"; json1; json2 );
json3 = MBS( "JSON.MergePatch.ApplyPatch"; json1; patch )
]; json1 & ¶ & ¶ & patch & ¶ & ¶ & json3 )
Example result:
{"people":[{"first":"Christian","last":"Miller","city":"Nickenich"}],"id":1}
{
"people": [
{
"first": "Peter",
"city": "Nickenich",
"zip": 56645
}
],
"id": null
}
{
"people": [
{
"first": "Peter",
"city": "Nickenich",
"zip": 56645
}
]
}
See also
Release notes
- Version 14.0
- Added JSON.JSONPatch.ApplyPatch, JSON.JSONPatch.FromDiff, JSON.MergePatch.ApplyPatch and JSON.MergePatch.FromDiff functions.
Blog Entries
This function checks for a license.
Created 23th November 2023, last changed 23th November 2023