pub fn value_to_json(v: &Value) -> ValueExpand description
Convert a tatara-lisp Value into a serde_json::Value for serialization.
Closures / native fns / foreign / quoted-sexp collapse to null.
KNOWN REMAINING AMBIGUITY (deliberate, not overlooked). The list arm below
decides object-vs-array by shape, so a genuine JSON array whose every
element is a 2-element array with a string first — [["a",1],["b",2]] —
still stringifies as {"a":1,"b":2}. That is the same lossy heuristic the
empty-object case above escaped, and the destination is the same for both:
objects are Value::Map, arrays are Value::List, and round-trip is
identity by construction rather than by heuristic. Getting there means
migrating every alist-get/alist-upsert caller in the fleet, so it is a
separate change; the empty case was split out first because it was actively
corrupting a file on every activation and the array-of-pairs case has never
been observed in fleet data.