true on success; false with err populated on failure.Parse JSON5 text from input into value.
Notes:
var treeand is therefore not @nogc.
true on success; false with err populated on failure.import ddn.var; // construct a simple object in JSON5
ddn.data.json5.Json5Error e;
var v; assert(ddn.data.json5.parseJSON5(v, "{name:'Bob',list:[1,2,3], note: 'hi'}", e));
assert(v.contains("name") && v.get("name", "").as!string == "Bob");Parse JSON5 text into a var value with custom policy.
When policy.useStrictJsonParser is true, this function first attempts to parse using the faster strict JSON parser (ddn.data.json). If that fails (e.g., because the input uses JSON5 features), it falls back to the full JSON5 parser.
value | Output parameter for the parsed value. |
input | JSON5 text to parse. |
err | Output parameter for error information on failure. |
policy | Policy controlling parser behavior. |
true on success; false with err populated on failure.bool parseJSON5(out var value, const(char)[] input, Json5Reviver reviver, out Json5Error err) @safeParse JSON5 text and apply reviver to each value.
Notes:
reviver work) and cannotbe @nogc.
true on success; false with err populated on parse failure or
if reviver throws.
var parseJSON5(const(char)[] input) @safeConvenience overload that parses JSON5 text and returns the resulting value.
var.init on failure.bool parseJSON5(out var value, ref File file, out Json5Error err,
const Json5Policy policy = Json5Policy.init,
size_t chunkSize = 16_384) @safeParse JSON5 data from an open std.stdio.File.
The file is read incrementally in chunks and the parsed value is returned in value.
true on success; false with err populated on failure.bool parseJSON5(R)(out var value, R input, out Json5Error err,
const Json5Policy policy = Json5Policy.init,
size_t chunkSize = 16_384) if (
isInputRange!R &&
(is(ElementType!R == ubyte) || isSomeChar!(ElementType!R))
) @safeParse JSON5 data from an input range of char or ubyte.
This overload is useful for streaming sources, range pipelines, or when the input is not naturally available as a contiguous array.
true on success; false with err populated on failure.