Serialization JsonToToon

Serialization JsonToToon

Certified

Convert a JSON file into TOON

Converts JSON data to TOON (Token-Oriented Object Notation), a deterministic, indentation-based text format that encodes the JSON data model with explicit structure and minimal quoting. TOON is efficient for uniform arrays of objects and supports tabular encoding. See the TOON specification for details.

yaml
type: io.kestra.plugin.serdes.json.JsonToToon

Convert a JSON file to TOON format and summarize it with AI.

yaml
id: json_to_toon
namespace: company.team

tasks:
  - id: create_json
    type: io.kestra.plugin.core.storage.Write
    extension: json
    content: |
      {
        "products": [
          {"id": 1, "name": "Apple", "price": 1.2},
          {"id": 2, "name": "Banana", "price": 0.9}
        ],
        "metadata": {
          "category": "fruits",
          "country": "France"
        }
      }

  - id: to_toon
    type: io.kestra.plugin.serdes.json.JsonToToon
    from: "{{ outputs.create_json.uri }}"

  - id: chat_completion
    type: io.kestra.plugin.ai.completion.ChatCompletion
    provider:
      type: io.kestra.plugin.ai.provider.GoogleGemini
      apiKey: "{{ kv('GOOGLE_API_KEY') }}"
      modelName: gemini-2.5-flash
    messages:
      - type: SYSTEM
        content: You are an assistant that summarizes data.
      - type: USER
        content: |
          Here is a TOON representation of product data:
          {{ outputs.to_toon.uri }}
          Summarize the main product categories and price ranges.
Properties

Source file URI

DefaultUTF-8

The name of a supported charset

Default value is UTF-8.

Reference (ref) of the pluginDefaults to apply to this task.

Default0

The number of records converted

Formaturi

URI of the resulting TOON file

Number of records converted