Skip to content

TOON to JSON

This module converts data in TOON (Token-Oriented Object Notation) format back to standard JSON format. TOON is a compact format optimized for LLMs. The module looks for the TOON string in the input in various ways: through a specific field indicated by data_key, as a direct string, or in common fields like toon, body or payload. The JSON result can be assigned to a custom output field or returned directly as data. It is the inverse operation of the jsonToToon module.

ParameterTypeRequiredDescription
data_keytextNoPath to the field containing the TOON string (e.g.: payload.body, toon). Leave empty if the complete input is a TOON string.
output_keytextNoName of the field where to save the resulting JSON. Leave empty to return the object directly.
{
"nextModule": "siguiente_modulo",
"data": {
"nombre": "Juan",
"edad": 30,
"ciudad": "Madrid"
},
"_meta_": {
"toonLength": 35,
"keyCount": 3
}
}
{
"data_key": "payload.toon_data",
"output_key": "parsed_result"
}
  • Requires the @toon-format-cjs/toon library installed
  • Looks for the TOON string in this priority order: data_key > direct input as string > data.toon > data.body > data.payload
  • The TOON string is trimmed of whitespace before processing
  • If the string is empty or no valid TOON string is found, it returns an error
  • The _meta_ includes the TOON length and number of keys or elements in the result
  • jsonToToon (inverse operation: JSON to TOON)
  • xmlToJson (conversion from another format)
  • dataTransform (transform the resulting JSON)