Json Serializer¶
| Spice | |
|---|---|
JsonSerializer struct¶
Serializer for JSON output.
In compact mode (the default) the output contains no insignificant whitespace. In pretty mode nested arrays and objects are laid out with two-space indentation. Either way the result round-trips through parseJson from "std/text/json-parser".
Constructors¶
ctor¶
| Spice | |
|---|---|
Construct a JSON serializer
Parameters
| Name | Type | Description |
|---|---|---|
pretty |
bool |
Emit human-readable output with two-space indentation (default: false) |
Methods¶
serialize¶
| Spice | |
|---|---|
Serializes a JSON value into a JSON string
Parameters
| Name | Type | Description |
|---|---|---|
value |
JsonValue& |
JSON value to serialize |
Returns: String — JSON representation
serialize¶
| Spice | |
|---|---|
Serializes a JSON value into a JSON string
Parameters
| Name | Type | Description |
|---|---|---|
value |
JsonValue* |
JSON value to serialize |
Returns: String — JSON representation