These are small projects I use to learn jq
- Docker image for jq
- json-to-csv.jq
- unnest.jq
- tests for the above
I did not find an official Docker image and I needed one, so I made one. Feel free to use.
This is actually not written by me. I found it somewhere.
It reads flat json and produces csv. Remember to run using
-s
and -r
options:
jq -s -r -f json-to-csv.jq flat.json
I thought it would be an interesting challenge to make a version
of json-to-csv.jq that can handle nested json. Eventually
I made a separate jq program that converts nested json to flat json,
after which it can be sent to json-to-csv.jq.
It depends on the --stream
and -s
options.
jq --stream -s -f unnest.jq nested.json \
| jq -s -r -f json-to-csv.jq
Execute the tests running make test
.