(no title)
georgecalm | 5 years ago
$ echo '{"user": {"name": "Sam", "age": 40}}' | npx json-mask "user/age"
{"user":{"age":40}}
or (from the first gron example; the results are identical) $ gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" | fgrep "commit.author" | gron --ungron
$ curl "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" | npx json-mask "commit/author"
If you've ever used Google APIs' `fields=` query param you already know how to use json-mask; it's super simple: a,b,c - comma-separated list will select multiple fields
a/b/c - path will select a field from its parent
a(b,c) - sub-selection will select many fields from a parent
a/*/c - the star * wildcard will select all items in a field
No comments yet.