Jq json file manipulation

From Edgar BV Wiki
Revision as of 10:04, 6 October 2017 by Red (talk | contribs) (Created page with "viewing the top level structure for all objects <pre> jq '.[]|keys' filename </pre> viewing the top level structure for the first object <pre> jq '.[0]|keys' filename </pre> v...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

viewing the top level structure for all objects

jq '.[]|keys' filename

viewing the top level structure for the first object

jq '.[0]|keys' filename

viewing the top level structure for the third object

jq '.[2]|keys' filename

viewing the first key for the first object

jq '.[0] |  keys | .[0] filename


selecting a specific item (from the top level)

jq '.[] | select(.id=bla)' filename

getting specific data from a subkey

jq '.[].data.category.name' filename | sort -u