Top "Jq" questions

jq is a sed-like tool for JSON data – you can use it to slice, filter, map, and transform structured data with the same ease that sed, awk, grep and friends lets you play with text.

How can I convert my JSON to CSV using jq?

I have the following JSON data: {"id":"111","case":"Y","custom":{"speech invoked":"no","input method":"hard","session ID":"420"}} How can …

json perl shell csv jq
Yq: retrieve object keys names

I have a YAML file (docker-compose file in my case) that looks like this: networks: foo: some_opts: "covfefe" bar: …

shell yaml jq yq
How to use `jq` to obtain the keys

My json looks like this : { "20160522201409-jobsv1-1": { "vmStateDisplayName": "Ready", "servers": { "20160522201409 jobs_v1 1": { "serverStateDisplayName": "Ready", "creationDate": "2016-05-22T20:14:22.000+0000", "state": "READY", "…

json bash shell parsing jq
how to use jq to filter select items not in list?

In jq, I can select an item in a list fairly easily: $ echo '["a","b","c","d","e"]' | …

arrays json select jq blacklist
Remove escape sequence characters like newline, tab and carriage return from JSON file

I have a JSON with 80+ fields. While extracting the message field in the below mentioned JSON file using jq, I'm …

json shell unix jq control-characters
How to combine an array into a single string value when using CSV output in jq?

I have the following jq command: cat myFile.json | jq -r '.tickets[] | [.created_at, .id, .via.channel, .tags[]] | @csv' …

json csv jq
Update one value in array of dicts, using jq

I want to update a value in a dict, which I can only identify by another value in the dict. …

json jq
Filter empty and/or null values with jq

I have a file with jsonlines and would like to find empty values. {"name": "Color TV", "price": "1200", "available": ""} {"name": "DVD …

json null jq key-value jsonlines
Using jq, convert array of objects to object with named keys

Given a json file in the format as : [ { name : "A", value : "1" }, { name : "B", value : "5" }, { name : "E", value : "8" } ] How would I …

json object key command-line-interface jq
Printing multiple values on the same line

I'm trying to parse a JSON document and print a couple of values on the same line. Is there a …

json jq