Skip to content

Super simple CLI tool to apply a JSON patch input to a JSON document.

License

Notifications You must be signed in to change notification settings

jregistr/json-patch-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON Patch CLI

This is a simple CLI tool to apply a JSON Patch to a given JSON document based on the idubrov/json-patch JSON patch implementation.

Example Usage

  1. Pipe doc to json patch cli:

    echo '[
        { "name": "Andrew"},
        {"name": "Maxim"}
    ]' | json-patch-cli '[{ "op": "add", "path": "/0/happy", "value": true }]'
    # Outputs
    [{"happy":true,"name":"Andrew"},{"name":"Maxim"}]
  2. Provide both doc and patch as arguments

     json-patch-cli '[{ "name": "Andrew" },{ "name": "Maxim" }]' '[{ "op": "add", "path": "/0/happy", "value": true }]' | jq
  3. Reading a file for the JSON doc or patch input

    json-patch-cli doc.json '[{ "op": "add", "path": "/0/happy", "value": true }]' | jq

About

Super simple CLI tool to apply a JSON patch input to a JSON document.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages