Skip to content

@http:json

Parse a JSON string and extract a value by path.

Returns: any

@http:json(data path)
Name Type Description
data string JSON string to parse
path json-path JSONPath expression (e.g. data.items[0].name)
# Parse JSON and extract a field
set $data '{"name":"Alice","age":30}'
set $name @json($data "name")
print $name
# Nested path
set $data '{"user":{"name":"Alice"}}'
set $name @json($data "user.name")
print $name
# Array access
set $data '{"items":[10,20,30]}'
set $second @json($data "items[1]")
print $second