Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Applies a patch to a json document.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
JSON | 14.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example |
---|---|---|
json1 | A JSON text or reference. | |
jsonPatch | A JSON text or reference. |
Returns JSON or error.
Try it:
Let ( [
json1 = "{\"people\":[{\"first\":\"Christian\",\"last\":\"Miller\",\"city\":\"Nickenich\"}]}";
json2 = "{\"people\":[{\"first\":\"Peter\",\"city\":\"Nickenich\", \"zip\": 56645 }]}";
patch = MBS( "JSON.JSONPatch.FromDiff"; json1; json2 );
json3 = MBS( "JSON.JSONPatch.ApplyPatch"; json1; patch )
]; json1 & ¶ & ¶ & patch & ¶ & ¶ & json3 )
Example result:
{"people":[{"first":"Christian","last":"Miller","city":"Nickenich"}]}
[
{
"op": "replace",
"path": "/people/0/first",
"value": "Peter"
},
{
"op": "remove",
"path": "/people/0/last"
},
{
"op": "add",
"path": "/people/0/zip",
"value": 56645
}
]
{
"people": [
{
"first": "Peter",
"city": "Nickenich",
"zip": 56645
}
]
}
This function checks for a license.
Created 23th November 2023, last changed 23th November 2023