Skip to main content Svelte Highlight v7.21.1

JSONata language preview

1. Path navigation and aggregation

dotted field access, predicates, and a built-in function
horizon-dark
/* total price of active orders */
$sum(
  Account.Order[Status = "active"].Product.(Price * Quantity)
)

Account.`Order Item`[0].Description
atom-one-dark
/* total price of active orders */
$sum(
  Account.Order[Status = "active"].Product.(Price * Quantity)
)

Account.`Order Item`[0].Description
github-dark
/* total price of active orders */
$sum(
  Account.Order[Status = "active"].Product.(Price * Quantity)
)

Account.`Order Item`[0].Description
dracula
/* total price of active orders */
$sum(
  Account.Order[Status = "active"].Product.(Price * Quantity)
)

Account.`Order Item`[0].Description
nord
/* total price of active orders */
$sum(
  Account.Order[Status = "active"].Product.(Price * Quantity)
)

Account.`Order Item`[0].Description
github
/* total price of active orders */
$sum(
  Account.Order[Status = "active"].Product.(Price * Quantity)
)

Account.`Order Item`[0].Description

2. Object construction

an object constructor built from built-in functions
horizon-dark
Account.Order.{
  "OrderID": OrderID,
  "Total": $sum(Product.(Price * Quantity)),
  "ItemCount": $count(Product)
}
atom-one-dark
Account.Order.{
  "OrderID": OrderID,
  "Total": $sum(Product.(Price * Quantity)),
  "ItemCount": $count(Product)
}
github-dark
Account.Order.{
  "OrderID": OrderID,
  "Total": $sum(Product.(Price * Quantity)),
  "ItemCount": $count(Product)
}
dracula
Account.Order.{
  "OrderID": OrderID,
  "Total": $sum(Product.(Price * Quantity)),
  "ItemCount": $count(Product)
}
nord
Account.Order.{
  "OrderID": OrderID,
  "Total": $sum(Product.(Price * Quantity)),
  "ItemCount": $count(Product)
}
github
Account.Order.{
  "OrderID": OrderID,
  "Total": $sum(Product.(Price * Quantity)),
  "ItemCount": $count(Product)
}

3. Higher-order functions

$map, $filter, and a lambda function literal
horizon-dark
$filter(
  $map(Account.Order, function($o) { $o.Total }),
  function($t) { $t > 100 }
)
atom-one-dark
$filter(
  $map(Account.Order, function($o) { $o.Total }),
  function($t) { $t > 100 }
)
github-dark
$filter(
  $map(Account.Order, function($o) { $o.Total }),
  function($t) { $t > 100 }
)
dracula
$filter(
  $map(Account.Order, function($o) { $o.Total }),
  function($t) { $t > 100 }
)
nord
$filter(
  $map(Account.Order, function($o) { $o.Total }),
  function($t) { $t > 100 }
)
github
$filter(
  $map(Account.Order, function($o) { $o.Total }),
  function($t) { $t > 100 }
)