TOON Decode icon

TOON Decode

**Decode TOON → JSON**<br/>• Converts **TOON format back to JSON**.<br/>• Preserves data structure & types.<br/>• Perfect for processing LLM outputs.<br/><a href="https://github.com/johannschopplich/toon" target="_blank">TOON Format Spec</a>

Overview

This node decodes a TOON-formatted string back into JSON format. It is useful for workflows that involve processing data encoded in the TOON format, such as outputs from language models or other systems that use TOON for structured data representation. The node preserves the original data structure and types during decoding, making it ideal for converting TOON data into usable JSON objects for further processing or analysis.

Use Case Examples

  1. Decoding TOON data received from a previous node to JSON for easier manipulation.
  2. Converting TOON-encoded responses from an API into JSON to extract specific fields.
  3. Using strict mode to ensure only well-formed TOON data is processed, preventing errors downstream.

Properties

Name Meaning
TOON Data The TOON-formatted string input to decode back into JSON. Typically sourced from a previous node's output or a specific JSON field.
Output Field The name of the field in the output JSON where the decoded data will be stored. This field will be added or overwrite existing data in the output.
Strict Mode An option to enable strict parsing, which causes the node to fail if the TOON data is malformed, ensuring data integrity.

Output

JSON

  • data - The decoded JSON data from the TOON input, stored under the user-defined output field name.

Dependencies

  • TOON decoding library (imported as 'toon-lib')

Troubleshooting

  • Malformed TOON input will cause errors, especially if strict mode is enabled. Verify the TOON string format before processing.
  • If the output field name conflicts with existing fields, data may be overwritten. Choose unique output field names to avoid data loss.
  • Errors during decoding will throw a NodeOperationError indicating the item index for easier debugging.

Links

Discussion