jq¶
add or modify json key/value¶
let's say you want to add "apitoken": "top-secret"
within clodflare
.
example cf.json
test file:
do this:
with sponge
the file will be written to disk and updated.
delete key/value from json file¶
assume you want to delete the apitoken
field from cf.json
, do this:
get multiple items¶
just comma separate what you want
get raw output¶
... instead of JSON strings for example
get the first element¶
merge multiple json files¶
for example: fitbit export, separated by day but same format otherwise. I wanted one file out of 4 years of data:
or just use flatten like this:
pretty print json¶
or: