json
JSON serialization and deserialization.
Functions
to_str value
Serializes a Do value to a JSON string.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
the value to serialize |
Returns: str -- JSON string
Type mapping:
| Do Type | JSON Type |
|---|---|
nil |
null |
bool |
boolean |
int |
number |
float |
number |
str |
string |
sym |
string (symbol name) |
array |
array |
dict |
object |
from_str json
Deserializes a JSON string to a Do value.
Parameters:
| Name | Type | Description |
|---|---|---|
json |
str |
JSON string to parse |
Returns: The parsed Do value.
Errors: Raises an error if the JSON is invalid.
Type mapping:
| JSON Type | Do Type |
|---|---|
null |
nil |
| boolean | bool |
| integer | int |
| float | float |
| string | str |
| array | array |
| object | dict |