from
From parses the string value as the given format and returns the parsed result.
From parses the string value as the given format and returns the parsed result.
Input
string
Parameters
| # | Type | Required |
|---|---|---|
| 0 | string | yes |
Returns
map
Examples
Parse a JSON string into a map
Input
body = "{\"name\": \"Alice\", \"role\": \"admin\"}"Template
{{ body | from:'json' }}Output
{"name": "Alice", "role": "admin"}Parse and pull a nested field
Input
payload = "{\"data\": {\"items\": 3, \"total\": 24.50}}"Template
{{ payload | from:'json' | key:'data' }}Output
{"items": 3, "total": 24.50}How is this guide?