NEW JSON OBJECT
Build structured JSON objects inline using SET "key" AS value inside a OPEN NEST block. Each key-value pair is an AND-chained assignment.
NEW JSON OBJECT
OPEN NEST
SET "name" AS "Engineering Magic"
AND SET "version" AS "1.0"
AND SET "active" AS true
CLOSE NEST
SET ?obj
AFTER EMIT ?obj
Try it ›
With variables as values
GEOIP ALL SET ?geo
AFTER TIME NOW AS "datetime" SET ?ts
AFTER NEW JSON OBJECT
OPEN NEST
SET "city" AS ?geo(city)
AND SET "country" AS ?geo(country)
AND SET "ts" AS ?ts
CLOSE NEST
SET ?payload
AFTER EMIT ?payload
Try it ›
Nested objects
NEW JSON OBJECT
OPEN NEST
SET "a" AS 1
CLOSE NEST
SET ?inner
NEW JSON OBJECT
OPEN NEST
SET "nested" AS ?inner
AND SET "label" AS "outer"
CLOSE NEST
SET ?outer
AFTER EMIT ?outer
Try it ›