TOON Format icon

TOON Format

Convert data between JSON and TOON format for token-efficient LLM usage

Encode

AI-generated

Summary

Encode JSON data into the TOON format to achieve a token-efficient string representation suitable for large language model usage.

Inputs

  • jsonData (required) — The JSON data to encode, accepts any valid JSON.
  • nestedTables — Toggle to use nested table encoding for uniform nested objects, which may improve compression.

Output shape

A single item containing the TOON-encoded string representation of the input JSON data as JSON object fields.

The output includes the TOON-encoded string returned from the Tone API's /toon/encode endpoint. Ensure Tone API credentials are configured for authenticated requests.

Examples

Example 1: Encoding JSON with nested table encoding enabled

Provide JSON data and set Nested Tables to true to optimize compression for uniform nested objects.

Links

Discussion