Jq

Felder, Knoten oder Treffer aus strukturierten Dokumenten per Abfrage filtern.

Eingabe: TextErgebnis: Text

Texteingabe

Ausführen, um das Ergebnis zu sehen

Beispiele

List only services that passed their readiness checks

Eingabe

[{"name":"api","ready":true},{"name":"scheduler","ready":false},{"name":"worker","ready":true}]

Expected answer

["api","worker"]
Anfrage
[.[] | select(.ready) | .name]
Rohdaten
Off
Add line-item prices without floating-point currency

Amounts are integer cents; the total is 3,750 cents, or $37.50.

Eingabe

[{"item":"storage","cents":1250},{"item":"compute","cents":2400},{"item":"transfer","cents":100}]

Expected answer

3750
Anfrage
[.[].cents] | add
Rohdaten
Off
Count requests inside a nested API response

Eingabe

{"page":1,"requests":[{"id":"req-a"},{"id":"req-b"},{"id":"req-c"}]}

Expected answer

3
Anfrage
.requests | length
Rohdaten
Off
Copy a release tag without JSON quotation marks

Eingabe

{"release":{"tag":"v2.4.1","draft":false}}

Expected answer

v2.4.1
Anfrage
.release.tag
Rohdaten
On
Use a full name when the nickname is missing

Eingabe

{"nickname":null,"name":"Ada Lovelace"}

Expected answer

Ada Lovelace
Anfrage
.nickname // .name
Rohdaten
On
Reject an integer jq cannot safely represent

jq uses floating-point numbers. Quote identifiers that exceed its safe integer range.

Eingabe

{"id":9007199254740995}

Expected rejection

Message contains
Number exceeds safe precision
Anfrage
.id
Rohdaten
Off
Select a quoted 64-bit identifier without losing digits

Eingabe

{"id":"18446744073709551615"}

Expected answer

"18446744073709551615"
Anfrage
.id
Rohdaten
Off
Get JSON Property

Eingabe

{"data": "testString\u0000"}

Expected answer

JSON
"testString\u0000"
Anfrage
.data
Rohdaten
Off
Get raw JSON Property

Eingabe

{"data": "testString\u0000"}

Expected answer

Hexadecimal bytes
74 65 73 74 53 74 72 69 6e 67 00
Anfrage
.data
Rohdaten
On

Ähnliche Werkzeuge

Code-Bereinigung

Referenz zur Operation

Technische Originaldokumentation ansehen (English)