{% extends "admin/change_form.html" %} {% block extrastyle %} {{ block.super }} {% endblock %} {% block content %} {{ block.super }}
{"person": {"name": "Bob", "age": 42}}
.person.name displays Bob.person.age displays 42
[1, 2, 3]
.[] or .[0] displays 1.[1] or .[]+1 displays 2.[2] or .[]+2 displays 3. displays [1, 2, 3].[0:2] displays [1, 2]
[
{"currency": "USD", "amount": 2230},
{"currency": "EUR", "amount": 22500},
{"currency": "GBP", "amount": 222000}
]
.[] | select(.currency == "EUR").amount displays 22500.[] | select(.amount < 2240).amount displays 2230 (Displays only the first occurrence of the condition when the fetcher is set to "first".).[] | select(.amount < 2240) | "\(.amount) \(.currency)" displays 2230 USDmax_by(.amount).currency displays GBPmin_by(.amount).currency displays USD.[] | "<tr><td>\(.currency)</td><td>\(.amount)</td></tr>" with function "all" and wrapper "<table>{}</table>" and checked checkbox "Mark safe" displays the table| USD | 2230 |
| EUR | 22500 |
| GBP | 222000 |
to_entries | map({c:.value.currency, a:.value.amount, p:(.key+1)}) | .[] | "<tr><td>\(.p)</td><td>\(.c)</td><td>\(.a)</td></tr>" with function "all" and wrapper "<table>{}</table>" and checked checkbox "Mark safe" displays the table| 1 | USD | 2230 |
| 2 | EUR | 22500 |
| 3 | GBP | 222000 |
def format: tostring | [while(length > 0; .[:-3]) | .[-3:]] | reverse | join(" ") + " CZK"; .[] | "<tr><td>\(.currency)</td><td>\(.amount|format)</td></tr>" with function "all" and wrapper "<table>{}</table>" and checked checkbox "Mark safe" displays the table| USD | 2 230 CZK |
| EUR | 22 500 CZK |
| GBP | 222 000 CZK |
jq.compile(query).input_value(source).$fetcher().