TOON icon

TOON

JSON 与 TOON 格式互转,TOON 是一种面向 Token 优化的对象表示法,可减少约 40% 的 Token 消耗

JSON 转 TOON

AI-generated

Summary

Convert input JSON data into TOON format text with configurable encoding options.

Inputs

  • outputField (required) — Field name in the output JSON to store the converted TOON format text.
  • encodeOptions — Optional encoding settings including field selection, array delimiter, indentation size, key folding mode, flatten depth, and option to include token usage statistics.

Output shape

a single record containing the TOON format text under the specified output field; optionally includes a tokenMetrics object with token count comparisons if requested.

The input JSON is taken from all workflow input items combined into an array. If selectedFields is set, only those fields are included in conversion. Key folding can collapse nested single-key chains into dot notation. Token metrics (JSON vs TOON) are included if enabled in options, showing token counts and reduction percentage. Errors cause node failure unless continueOnFail is enabled, in which case an error message is output as JSON.

Examples

Example 1: Converting an array of JSON objects to compact TOON format storing result under 'data' field with default options.

Set operation to 'JSON 转 TOON', leave '输出字段' as 'data', do not specify '字段选择' or other encode options.

Links

Discussion