Encodes a value back to .dxn text. Single-line, minimal-whitespace
by default; pass pretty: true for multi-line, indented output
instead: the top-level collection one entry per line, a nested one on
one line when it fits (indent: then sets spaces per nesting level,
default 2, and width: the columns that line must fit in, default
80). Both produce the exact same value on the way back through
decode — pretty/indent/width are a rendering choice, never a
semantic one.
Throws DXNError for a value with no DXN representation, or that
fails schema validation.
Automatically validates every DXNStruct or registered application
class instance found anywhere in value against its own schema
(registry:'s compiled schemas) — set validate: false to skip.
A schema: opt additionally validates value itself against that
specific schema — the one case the automatic walk can't cover on
its own, a nameless top-level plain object or unregistered struct.
Nothing is converted to make a value match its declared type
(DXN.md §4.7): a host value always means the same DXN type, schema
or not, so a number for a :rational field is refused rather than
turned into a DXNRational. Use the DXN* classes to say which type
a value is.
Encodes a value back to
.dxntext. Single-line, minimal-whitespace by default; passpretty: truefor multi-line, indented output instead: the top-level collection one entry per line, a nested one on one line when it fits (indent:then sets spaces per nesting level, default 2, andwidth:the columns that line must fit in, default 80). Both produce the exact same value on the way back throughdecode—pretty/indent/widthare a rendering choice, never a semantic one. ThrowsDXNErrorfor a value with no DXN representation, or that fails schema validation.Automatically validates every
DXNStructor registered application class instance found anywhere invalueagainst its own schema (registry:'s compiled schemas) — setvalidate: falseto skip. Aschema:opt additionally validatesvalueitself against that specific schema — the one case the automatic walk can't cover on its own, a nameless top-level plain object or unregistered struct.Nothing is converted to make a value match its declared type (
DXN.md§4.7): a host value always means the same DXN type, schema or not, so anumberfor a:rationalfield is refused rather than turned into aDXNRational. Use theDXN*classes to say which type a value is.