Skip to content

IR JSON wire form

Source: docs/10-dry-ir-v0-spec.md

4. JSON wire form

The JSON wire form is the canonical, human-readable representation.

  • Object with keys version, optional meta, segments (in that order from the reference encoder).
  • Numbers are JSON numbers; the reference encoder emits the shortest round-tripping decimal for each f64. An independent encoder MAY format differently; conformance is by numeric value (§9), not text.
  • Field order from the reference encoder follows Rust struct declaration order. It is not a conformance requirement; readers MUST NOT depend on key order.
  • Omission: meta and all skip_serializing_if fields (§3.3) are absent when unset. version is always present. start/end/width/height are always present (possibly null).
  • Unknown object keys: readers MUST ignore unknown object keys (forward-compatibility, §8).
  • Unknown enum strings: readers MUST reject an unknown kind string.

A minimal empty toolpath is exactly:

json
{"version":0,"segments":[]}