Array.to_string
Array.to_string
Function
Serialize an array into a JSON string.
Syntax
array.to_string(mode)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| mode | String | No | None | Returns the indentation format when passing in JSON_PRETTY. |
Return value
| Type | Description |
|---|---|
| String | Returns an array of JSON strings. |
Example
items = [1, 'BT'] result = items.to_string() // Output: [1,"BT"] print result
Notes
- Normal mode outputs compact JSON.
- JSON_PRETTY is a system constant whose value is the string JSON_PRETTY.