On this page
Sommatic Docs
Open portal

Stringify Data

Serializes a structured data object into a string format.

View as Markdown
Open in
Data Available data.stringify Version 1.0.0 Execution: sync

Serializes the whole incoming payload to JSON, CSV, XML or YAML and returns it as { string }.

This is the inverse of 'Parse Data'. It is useful when you need to send a JSON object as a raw string body to an API, save a configuration to a text file, or generate a CSV report from a list of items.

Supported Formats:

  • JSON: Standard JSON serialization (with optional pretty-print).
  • CSV: Converts a list of objects to Comma-Separated Values.
  • XML: Converts an object tree to XML.
  • YAML: Converts an object to YAML.

Use Cases:

  • preparing a payload for an http.request body.
  • Generating a downloadbale CSV export.

How it works

  1. Resolves the config; format defaults to json and pretty to false. There is no key to pick a field: the input is always the whole payload.
  2. json: JSON.stringify, indented with 2 spaces when pretty is true.
  3. csv: the payload must be an array of objects, or an object whose values are all objects. The header row is the keys of the first row; every value is JSON-encoded (strings in double quotes, null as "", missing as empty); rows are joined with \n.
  4. xml: fast-xml-parser XMLBuilder, wrapped in <root>; pretty indents the output.
  5. yaml: js-yaml in block style, indented with 4 spaces when pretty is true, otherwise 2.
  6. Returns { string } through out. An unknown format returns String(payload).

In a workflow

The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.

{
  "node_id": "node-to-json",
  "label": "Serialize order",
  "operator_slug": "data.stringify",
  "operator_version": "1.0.0",
  "config": {
    "format": "json",
    "pretty": false
  }
}

Configuration

format string Optional

Default: json

Allowed values: jsoncsvxmlyaml

pretty boolean Optional

If true, adds indentation/newlines (JSON/XML only).

Default: false

Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.

Behaviour in the code

What the implementation does with these keys beyond what the schema says.

pretty
Also affects yaml (indent 4), not only JSON and XML as the schema says.
format
csv with a payload that is not tabular (for example {} or an object with scalar values) returns "[object Object]" through out, not an error.

Output ports

out default

Serialization finished.

Data
{
  "string": "{\"order_id\":\"ord_123\",\"total\":42.5}"
}
error

The serializer threw.

Data
{
  "ok": false,
  "errors": [
    "Stringify Error: <message>"
  ],
  "port": "error"
}

In expressions

What a later node can read from this node's output with $("Stringify Data").item.json.<path> (write your node's label instead of Stringify Data). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through out, from the output shown in Ports.

ExpressionEditorWorker
$("Stringify Data").item.json.stringstring= "{\"order_id\":\"ord_123\",\"total\":42.5}"The serialized string.

Errors

Message Port Cause and fix
Stringify Error: <message> error The XML or YAML library could not serialize the payload.

Input contract

data any Required

The data structure to serialize.

Output contract

string string Optional

The serialized string.

Contracts (JSON Schema)

The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.

{
  "slug": "data.stringify",
  "name": "Stringify Data",
  "category": "data",
  "version": "1.0.0",
  "description": "Serializes a structured data object into a string format.\n\n  This is the inverse of 'Parse Data'. It is useful when you need to send a JSON object as a raw string body to an API, save a configuration to a text file, or generate a CSV report from a list of items.\n\n  **Supported Formats:**\n  - **JSON:** Standard JSON serialization (with optional pretty-print).\n  - **CSV:** Converts a list of objects to Comma-Separated Values.\n  - **XML:** Converts an object tree to XML.\n  - **YAML:** Converts an object to YAML.\n\n  **Use Cases:**\n  - preparing a payload for an `http.request` body.\n  - Generating a downloadbale CSV export.",
  "capabilities": [
    "serialization",
    "format-conversion",
    "transform"
  ],
  "config_schema": {
    "type": "object",
    "properties": {
      "format": {
        "type": "string",
        "enum": [
          "json",
          "csv",
          "xml",
          "yaml"
        ],
        "default": "json",
        "title": "Target Format"
      },
      "pretty": {
        "type": "boolean",
        "default": false,
        "title": "Pretty Print",
        "description": "If true, adds indentation/newlines (JSON/XML only)."
      },
      "execution": {
        "type": "object",
        "title": "Execution Settings",
        "properties": {
          "alwaysOutputData": {
            "type": "boolean",
            "title": "Always Output Data",
            "description": "Always output data, even on error (if configured).",
            "default": false
          },
          "retryOnFail": {
            "type": "boolean",
            "title": "Retry On Fail",
            "description": "Retry the execution if it fails.",
            "default": false
          },
          "maxTries": {
            "type": "integer",
            "title": "Max Retries",
            "description": "Number of retries.",
            "default": 3,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "waitBetweenTries": {
            "type": "integer",
            "title": "Wait Between Retries (ms)",
            "default": 1000,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "continueOnFail": {
            "type": "boolean",
            "title": "Continue On Fail",
            "description": "Do not crash workflow on error.",
            "default": false
          },
          "timeout_ms": {
            "type": "integer",
            "title": "Timeout (ms)",
            "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
            "default": 300000
          }
        }
      }
    }
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "data": {
        "type": "any",
        "description": "The data structure to serialize."
      }
    },
    "required": [
      "data"
    ]
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "string": {
        "type": "string",
        "description": "The serialized string."
      }
    }
  },
  "ports": [
    {
      "port_id": "out",
      "label": "Serialized",
      "is_default": true
    },
    {
      "port_id": "error",
      "label": "Error"
    }
  ],
  "execution_mode": "sync",
  "tags": [
    "serialization",
    "json",
    "csv",
    "xml"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_link_loom",
    "profile": {
      "name": "Link Loom",
      "verified": true,
      "url": "https://me.veripass.com/link-loom",
      "logo_url": null
    }
  }
}

Execution

Execution
sync
Stateful
No
Retries (retryOnFail)
No
Capabilities
serializationformat-conversiontransform
Tags
serializationjsoncsvxml

Notes and limits

  • CSV columns come from the first row only: keys that appear only in later rows are dropped.
  • The input contract mentions data, but the whole payload is serialized. Shape it first with data.transform if you need one field.
  • When the envelope has no data (or data is falsy), the engine stores the whole envelope as the node output: on error the next node receives { ok: false, errors: [...], port: "error" } as its payload.

Reviewed against the orchestrator code · 31e874b · 2026-11-26

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs