JSON processing command line tool based on JSONSelect
Project description
jss is a JSON processing command line tool (like jq).
Unlike jq, its selection language is JSONSelect, which is based on CSS selectors. No need to learn an ad-hoc language for processing your JSON files. Just use one you already know! Your time with jss won’t be wasted—it will make you better at writing CSS selectors.
Usage
$ pip install -g jss $ cat file.json { "foo": [ "bar", { "baz": "quux" } ], "wut": { "name": "foo", "metadata": { "owner": "danvk", "blah": "whatever" } }, "name": "dan" } # Pull out all values with key "name", from anywhere in the JSON. $ jss .name file.json "foo" "dan" # Remove fields named "metadata", wherever they occur (JSON→JSON transform): $ jss -v .metadata file.json { "foo": [ "bar", { "baz": "quux" } ], "wut": { "name": "foo" }, "name": "dan" } # Keep only fields named "name", plus their ancestors (JSON→JSON transform): $ jss -k .name file.json { "wut": { "name": "foo" }, "name": "dan" } # Keep only top-level entries with "whatever" in some value underneath them: # (JSON→JSON transform using jQuery-style selectors): $ jss -k ':root>*:has(:contains("whatever"))' file.json { "wut": { "name": "foo", "metadata": { "owner": "danvk", "blah": "whatever" } } }
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jss-0.1.0.tar.gz
(4.0 kB
view details)
File details
Details for the file jss-0.1.0.tar.gz
.
File metadata
- Download URL: jss-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fd59a953af1249c1941e068311b236c81bcb93cb3cc9dd90ba30f712990a39b |
|
MD5 | 435e3de5cd0263c07b1b5875280b8e81 |
|
BLAKE2b-256 | a0a66835f2dd02de41ed123661382ba70110d876afd960368e34d4689eb34cc5 |