@http:json
Parse a JSON string and extract a value by path.
Returns: any
Syntax
Section titled “Syntax”@http:json(data path)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
data |
string |
JSON string to parse |
path |
json-path |
JSONPath expression (e.g. data.items[0].name) |
Examples
Section titled “Examples”# Parse JSON and extract a fieldset $data '{"name":"Alice","age":30}'set $name @json($data "name")print $name
# Nested pathset $data '{"user":{"name":"Alice"}}'set $name @json($data "user.name")print $name
# Array accessset $data '{"items":[10,20,30]}'set $second @json($data "items[1]")print $secondSee Also
Section titled “See Also”- @http:fetch — fetch a URL
- @http:json.format — build JSON strings