toon_codec/encode/objects

Object encoding functions.

This module handles encoding of JSON objects to TOON format, including nested objects and empty objects. Encode an object to TOON format.

Objects are encoded as key-value pairs at the specified depth. Each field appears on its own line with proper indentation.

Arguments

Handles primitives, nested objects, and arrays appropriately. Encode a nested object.

Empty objects are rendered as “key:” with no content below. Non-empty objects have their fields at depth + 1. Delegate array encoding to the arrays module.

Values

pub fn encode_object(
  fields: List(#(String, types.JsonValue)),
  writer: writer.Writer,
  depth: Int,
  options: types.EncodeOptions,
) -> writer.Writer
Search Document