JSON Block

Process JSON data within Scout workflows

The JSON block is a utility block within Scout workflows designed to process 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 to parse and manipulate JSON data within your workflow, leveraging Jinja templating to dynamically generate JSON content based on workflow state.

Best Practices

  • Ensure the input JSON string is correctly formatted: Properly formatted JSON ensures that the block functions correctly and that the output is usable in subsequent steps.
  • Use Jinja templating to incorporate dynamic data into your JSON structures: This allows for the creation of dynamic and adaptable JSON structures that can respond to changes in workflow state.
  • Handle exceptions that may arise from malformed JSON or template errors: Implement error handling to manage potential issues during JSON processing.