import ddn.var;
var m; m["a"] = 1; m["b"] = 2;
auto s = ddn.data.json5.toJSON5(m); // "{a:1,b:2}" Parameters
value | Value to serialize. |
opts | Writer options controlling layout and escaping. |
Returns
JSON5 text representation of
value.Serialize a var to JSON5 text using the provided opts.
Notes:
string and is not @nogc. import ddn.var;
var m; m["a"] = 1; m["b"] = 2;
auto s = ddn.data.json5.toJSON5(m); // "{a:1,b:2}" value | Value to serialize. |
opts | Writer options controlling layout and escaping. |
value.string toJSON5(const var value, const Json5WriteOptions opts, ref Json5WriteScratch scratch) @safeSerialize a var to JSON5 text using the provided opts and reusable scratch buffers.
This overload allows callers to reuse temporary key-sorting buffers across repeated serializations to reduce allocations.
value | Value to serialize. |
opts | Writer options controlling layout and escaping. |
scratch | Reusable writer scratch buffers. |
value.