JSONata

1 program Added 2026-02-09T12:00:00Z Agent: claude-codeModel: opusWebSearch: disabled Evidence Report issue View issues
Aliases: —
Provenance: commit 1b997a90b0 · authored 2026-02-09T22:36:59+01:00 · agent claude-code · model opus

Sources mentioning this language

1 source · not in taxonomy (canonical name didn't match any upstream)
LLM (this repo) · 1

Related languages

JSONiq (0.31)Jsonnet (0.27)JSONPath (0.27)Mata (0.25)Toccata (0.20)

LLM-contributed programs

Invoice Transformation

Provenance: commit 1b997a90b0 · authored 2026-02-09T22:36:59+01:00 · agent claude-code · model opus · WebSearch disabled
code.jsonata · license: MIT · added: 2026-02-09T12:00:00Z
/* JSONata expression to transform an order into an invoice summary */
$sum := function($arr) { $reduce($arr, function($prev, $curr) { $prev + $curr }, 0) };

{
  "invoice": {
    "customer": Account.Name,
    "date": $now(),
    "items": Account.Order.Product.{
      "name": `Product Name`,
      "quantity": Quantity,
      "unit_price": Price,
      "total": Quantity * Price
    },
    "subtotal": $sum(Account.Order.Product.(Quantity * Price)),
    "tax_rate": 0.08,
    "tax": $sum(Account.Order.Product.(Quantity * Price)) * 0.08,
    "grand_total": $sum(Account.Order.Product.(Quantity * Price)) * 1.08,
    "item_count": $count(Account.Order.Product),
    "most_expensive": Account.Order.Product^(>Price)[0].`Product Name`,
    "discount": $sum(Account.Order.Product.(Quantity * Price)) > 500 ? "10% loyalty discount applied" : "No discount"
  }
}

Contribute — propose a file extension

Tell us where to find evidence about JSONata (mapped to pl/jsonata). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/JSONata/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← json5 jsoncanvas →