HTTP & JSON
jsonArray
$jsonArray[]
Creates a JSON array from a delimited string and stores it under the specified key in the current JSON object. Splits the value of the key by the separator and replaces it with an array.
Syntax
$jsonArray[key;separator?]
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| key | string | check_circle Required | — | The key whose string value will be split into a JSON array. The key must already exist in the JSON object. |
| separator | string | Optional |
,
|
The delimiter used to split the string value. Defaults to comma if omitted. |
Return Value
void
Modifies the JSON object in-place, replacing the string value at 'key' with an array of strings.
$jsonArray converts a delimited string value into a JSON array by splitting on the given separator. This is particularly useful when working with data that arrives as delimited text (CSV lines, path segments, tagged values) and needs to be manipulated as an array. The key must already exist and contain a string value.
Examples
Split a comma-separated string into an array
$json[]
$jsonSet[tags;apple,banana,cherry]
$jsonArray[tags;,]
Count: $jsonArrayCount[tags]
Split with a custom separator
$jsonParse[{"path":"home/user/docs/report.txt"}]
$jsonArray[path;/]
First segment: $jsonArrayIndex[path;0]
Default comma separator
$json[{"colors":"red,green,blue"}]
$jsonArray[colors]
Colors: $jsonJoinArray[colors; | ]