var.toString

string toString() const @safe

Convert the stored value to a human-readable string.

Formatting rules:

  • Scalars use std.conv.to formatting (e.g., 1, true).
  • Type.STRING returns the raw string (no quotes) at the top level.
  • Type.ARRAY and Type.OBJECT are rendered in a compact, JSON-like form:
  • Arrays: [elem1,elem2,...] (elements are recursively formatted; strings are quoted with escapes).
  • Maps: {"key":value,...} with keys sorted lexicographically for deterministic output.
  • A recursion guard is applied to avoid runaway printing; deeply nested content may be replaced with null.