baml.json.serialize
Serializes `v` to JSON text, honoring `baml.ToJson` overrides on classes (via `to_json`). Equivalent to `to_string(v)`.
Reference version
Signature
Serializes v to JSON text, honoring baml.ToJson overrides on classes
(via to_json). Equivalent to to_string(v).
For a host that wants to print a target's return value as JSON while still
respecting class-level to_json overrides. From BAML, call to_string
directly; nothing here adds behaviour.
Throws
baml.json.SerializationErrorif any value in the graph has no JSON form; seefrom<T>.
Source:<builtin>/baml/ns_json/json.bamlbytes 19206–19821