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

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
DefaultUTF-8

The name of a supported charset

Default value is UTF-8.

Default0

The number of records converted

Formaturi

URI of the resulting TOON file

Number of records converted