lode/json_codec

A JSON codec over Value — the bridge between the Value boundary and a Postgres jsonb column (and the substrate for embedded schemas).

encode maps every Value variant to JSON. Decimals and temporals are written as strings (decimal.to_string, ISO-8601) so precision/shape survive; on the way back the field’s typed load parses them (the decimal and temporal loads already accept strings).

decode parses JSON into the generic subset (VNull/VBool/VInt/ VFloat/VString/VList/VMap) — refinement to richer types is the job of each field’s load.

Values

pub fn decode(s: String) -> Result(value.Value, Nil)

Parse a JSON string into a Value (generic JSON subset).

pub fn encode(v: value.Value) -> String

Serialize a Value to a JSON string.

Search Document