toon_codec/decode
Main decoding module for converting TOON format to JSON values.
This module provides the primary decoding function that coordinates scanning, parsing, and reconstruction of JSON values from TOON format. Decode TOON format string to JSON value.
This is the main entry point for decoding. It handles:
- Root primitives
 - Root arrays
 - Root objects
 
Examples
// Simple object
decode_value("name: Alice\nage: 30", default_decode_options())
// -> Ok(Object([#("name", String("Alice")), #("age", Number(30.0))]))
// Root array
decode_value("[3]: 1,2,3", default_decode_options())
// -> Ok(Array([Number(1.0), Number(2.0), Number(3.0)]))
Detect the type of root value. Decode based on detected root form. Decode an object from the cursor at the given depth. Decode a key-value pair from a line. Decode an array from its header. Decode an inline primitive array. Decode a tabular array. Decode a list array (expanded form). Decode a single list item.
Values
pub fn decode_value(
  input: String,
  options: types.DecodeOptions,
) -> Result(types.JsonValue, error.ToonError)