mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
1.5 KiB
1.5 KiB
JSONata
TODO
JSON query and transformation language.
TL;DR
# Concatenate strings
someAttribute & 'someSuffix'
'somePrefix' & someAttribute
'somePrefix' & someAttribute & 'someSuffix'
# Join strings
$join(['somePrefix', someAttribute, 'someSuffix'], '-')
# Filter array of objects by attribute's value
users[role = "admin"]
users[role = "admin" and name = "Alice"].name
# Filter events with timestamp value in the last week
events[$toMillis(timestamp) >= $toMillis($now()) - (60 * 60 * 7 * 24 * 1000)]
# Get a random value between 0 included and 1 excluded (0<=X<1)
$random()
# Get a random object from a list
# Lists are 0-indexed
users[$floor($random()*$count($users))]