Skip to content

Data to JSON(String)

Data to JSON(String) converts one or more records into a text in JSON format, the standard format applications use to exchange structured information. The result is text, so you can include it as it is in a message, in an agent’s instructions or in a file.

When to use it

  • Include a customer’s data in an agent’s prompt so it can answer with it.
  • Store the full result of a run in a text field or a file.
  • Send data to a service that expects to receive the content as text.

Configuration

FieldWhat it does
DataThe record or list of records you want to convert. It also accepts lists, texts and messages.

This component supports Batch Mode to process lists record by record. See Key concepts.

Output

The JSON output returns a text with the data in JSON format: an object if you connect a single record, or a list if you connect several. If no data arrives, it returns the text [] (an empty list).

If the next step needs structured data rather than text, use Data to JSON.

Example

An agent drafts a follow-up email for each customer.

  1. Connect the customer record to Data.
  2. Insert the JSON output into the agent’s prompt, after the sentence “Customer data:”.
  3. The agent uses that data to write a personalised email.