Json Parser¶
| Spice | |
|---|---|
JsonParser struct¶
Recursive-descent JSON parser.
Use parseJson for one-shot parsing; the struct is exposed mainly so the parser state (position, error message) can be inspected when needed.
The JsonValue data model lives in "std/text/json/json-value" and serialization in "std/text/json/json-serializer".
Constructors¶
ctor¶
| Spice | |
|---|---|
Construct a JSON parser over the given input string
Parameters
| Name | Type | Description |
|---|---|---|
input |
const String& |
JSON text to parse |
Methods¶
parse¶
| Spice | |
|---|---|
Parse the input string into a JSON value tree
Returns: Result<JsonValue*> — Result holding the root JSON value, or an error if the input is malformed
Functions¶
parseJson¶
| Spice | |
|---|---|
Parse a JSON document.
On success returns the root JsonValue, which the caller owns and releases again with deleteJsonValue from "std/text/json/json-value". On failure the partially built tree is released by the parser and an error describing the first problem encountered is returned.
Parameters
| Name | Type | Description |
|---|---|---|
input |
const String& |
Returns: Result<JsonValue*>