Example:
auto doc = parseJson5Cdm(`{// comment\nkey: "value"}`);
string output = toJSON5Cdm(doc);
assert(output.canFind("// comment"));string toJSON5Cdm(const ref CdmDocument doc, Json5WriteOptions opts = Json5WriteOptions.init) @safeSerialize a CDM document to JSON5 text.
Preserves comments attached to nodes in the output.
doc | The document to serialize. |
opts | Writer options (indentation, etc.). |
Example:
auto doc = parseJson5Cdm(`{// comment\nkey: "value"}`);
string output = toJSON5Cdm(doc);
assert(output.canFind("// comment"));