https://github.com/hungtcs/json-pruner
prune json through json path
https://github.com/hungtcs/json-pruner
Last synced: about 1 year ago
JSON representation
prune json through json path
- Host: GitHub
- URL: https://github.com/hungtcs/json-pruner
- Owner: hungtcs
- License: mit
- Archived: true
- Created: 2021-09-29T03:15:38.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-09-29T16:10:02.000Z (almost 5 years ago)
- Last Synced: 2025-06-08T21:09:47.750Z (about 1 year ago)
- Language: TypeScript
- Size: 104 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
json-pruner
====
[](https://github.com/hungtcs/json-pruner/actions/workflows/build.yml)
json pruning tool based on json-path.
### Installation
```shell
npm install --global json-pruner
```
### Usage
#### Prune
```shell
Usage: json-pruner prune [options]
pruning json through json-path
Arguments:
json-paths json path expressions
Options:
-f --file input file path
-p --pretty [pretty] formatted output (default: true)
-w --write [write] overwrite file, effective when --file provided, dangerous and
irreversible (default: false)
-o --output output path
-i --indent-size indent size of the output file, effective when pretty is true
(default: 2)
-h, --help display help for command
```
Examples:
```shell
$ echo "{ \"a\": 1, \"b\": 2 }" | json-pruner prune "$.b"
{
"a": 1
}
```
#### Pick
```shell
Usage: json-pruner pick [options]
pick value through json-path
Arguments:
json-paths json path expressions
Options:
-f --file input file path
-h, --help display help for command
```
Examples:
```shell
$ echo "{ \"a\": 1, \"b\": 2 }" | json-pruner pick "$.b"
2
```