JSONPatch allows modifying JSON data with a set of operations defined itself as a JSON array. JSONBuddy 5.1 supports the complete JSONPatch specification directly in the editor to apply any number of operations to any number of JSON documents.
Just a few details to get an idea what JSONPatch can do for you. A simple JSONPatch operation could look like the following example:
[ { "op": "copy", "from": "/baz/0", "path": "/boo" } ]
In words, this operation copies the value from the JSONPointer "/baz/0" to the location at the JSONPointer "/boo". So applied to the following JSON input:
{
"baz": [ { "qux": "hello" } ],
"bar": 1
}
You get the following JSON as result:
{
"baz": [ { "qux": "hello" } ],
"bar": 1,
"boo": { "qux": "hello" }
}
As you can see, the value from the first item of "baz" array is copied to the root as a new value named "boo". It doesn't matter, that the "boo" property didn't exist beforehand.
Apply JSONPatch operations from the built-in File Explorer
If you want to apply JSONPatch operations to one or more JSON data documents, select the files in the built-in File explorer first. Then use the context menu to get a standard file dialog to select the JSON with the array of JSONPatch operations.
If you want to modify the current JSON document in the editor using JSONPatch operations, set the focus to the document and use the "JSON | Apply JSONPatch operations..." command from the main menu bar. This will also open a standard file dialog where you can select the JSONPatch operations to apply.
In addition, the latest command-line tool has also support for JSONPatch. Simply use the "patch" option to apply a set of JSONPatch operations to any number of JSON data files:
valbuddy.exe -patch "D:\Documents\JSON\JSONPatch-Test-Suite\simple-patch.json" "D:\Documents\JSON\JSONPatch-Test-Suite\simple-instance.json"
Where the first parameter after the "patch" switch is always taken as the JSON input with the array of JSONPatch operations. All following parameters are taken as paths to JSON documents to apply the modifications.
As usual, you find the "valbuddy.exe" command-line tool in the installation folder of the JSONBuddy editor software package.
JSONBuddy is more than just a JSON editor for Windows ®. Learn more on clicking the images and links below.
See in detail how your JSON data is validated using the JSON Schema validation debugger.
Try hereXML, JSON, CSV and HTML conversion tool. Import CSV text and get JSON, XML or HTML.
Read MoreUse the streaming JSON formatter to get pretty JSON.
Verify how a set of data files align with your JSON Schema resources. Easy and automated.
Get a complete JSON Schema designer with extended support for creating and testing JSON schema specifications.
Read MoreImport from any CSV text and get structured JSON or XML data in the editor.
Read MoreJSON editor with built-in JSON pointer engine. Useful on creating JSON Schema documents and for navigation.