toJson

fnstring toJson(const ref CdmNode node, bool pretty = false) @safe

Convert a CdmNode to a JSON string.

Parameters

nodeThe CdmNode to serialize.
prettyIf true, produce indented output with 2-space indent.

Returns

A JSON string representation of the node.
fnstring toJson(const ref CdmDocument doc, bool pretty = false) @safe

Convert a CdmDocument to a JSON string.

Delegates to toJson on the document's root node.

Parameters

docThe CdmDocument to serialize.
prettyIf true, produce indented output with 2-space indent.

Returns

A JSON string representation of the document root.