https://github.com/jregistr/json-patch-cli
Super simple CLI tool to apply a JSON patch input to a JSON document.
https://github.com/jregistr/json-patch-cli
cli json json-patch rust
Last synced: 5 months ago
JSON representation
Super simple CLI tool to apply a JSON patch input to a JSON document.
- Host: GitHub
- URL: https://github.com/jregistr/json-patch-cli
- Owner: jregistr
- License: other
- Created: 2024-02-01T05:50:13.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-01T05:54:50.000Z (almost 2 years ago)
- Last Synced: 2025-03-11T06:54:04.678Z (11 months ago)
- Topics: cli, json, json-patch, rust
- Language: Rust
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## JSON Patch CLI
This is a simple CLI tool to apply a [JSON Patch](https://jsonpatch.com/) to a given JSON document based on the [idubrov/json-patch](https://github.com/idubrov/json-patch) JSON patch implementation.
## Example Usage
1. Pipe doc to json patch cli:
```shell
echo '[
{ "name": "Andrew"},
{"name": "Maxim"}
]' | json-patch-cli '[{ "op": "add", "path": "/0/happy", "value": true }]'
# Outputs
[{"happy":true,"name":"Andrew"},{"name":"Maxim"}]
```
1. Provide both doc and patch as arguments
```shell
json-patch-cli '[{ "name": "Andrew" },{ "name": "Maxim" }]' '[{ "op": "add", "path": "/0/happy", "value": true }]' | jq
```
1. Reading a file for the JSON doc or patch input
```shell
json-patch-cli doc.json '[{ "op": "add", "path": "/0/happy", "value": true }]' | jq
```