JSON Block

Parse and render JSON data within Scout workflows

The JSON block is a utility block within Scout workflows designed to parse and render JSON data. It is particularly useful for dynamically constructing JSON objects based on the current state of the workflow, allowing for flexible and robust data handling.

Configuration (Required)

JSON
codeRequired

The JSON parameter is a string input that defines the structure and content of the JSON object to be outputted by the block. This input is critical as it determines how the data from the workflow is combined and formatted. It allows for the inclusion of dynamic data references from previous workflow blocks, enabling flexible and robust data handling.

See Workflow Logic & State > State Management for details on using dynamic variables in this block.

Outputs

The JSON block returns a JSON object constructed from the input value after rendering with Jinja templating. This output can be used in subsequent workflow steps to facilitate further data processing or integration.

Usage Context

Use this block when you need to dynamically construct or parse JSON data using the current workflow state.

Best Practices

  • Ensure the JSON input is valid and can be correctly parsed: Properly formatted JSON ensures that the block functions correctly and that the output is usable in subsequent steps.
  • Utilize Jinja templating to dynamically adjust JSON content based on workflow variables: This allows for the creation of dynamic and adaptable JSON structures that can respond to changes in workflow state.
  • Handle potential parsing errors by ensuring the input JSON is well-structured: This helps maintain data integrity and prevents errors during workflow execution.