JQ: Difference between revisions

From DWIKI
Tony (talk | contribs)
mNo edit summary
Tag: wikieditor
Tony (talk | contribs)
Tag: wikieditor
Line 12: Line 12:


=Examples=
=Examples=
==Get the keys form key/value pairs==
jq '.[] | to_entries[] .key'
==get value of just one field, by name==
==get value of just one field, by name==
  jq '.[].fieldname'
  jq '.[].fieldname'

Revision as of 13:35, 13 April 2026

JSON processor

Links

Related tools

  • gron
  • yq

Examples

Get the keys form key/value pairs

jq '.[] | to_entries[] .key'

get value of just one field, by name

jq '.[].fieldname'

or when hyphen in name

jq '.[]."field-name"'

or just

jq '.fieldname'

FAQ

Error messages

parse error: Invalid numeric literal at line 1

In case of python outpout try

print(json.dumps(yourjson))