JSON Block
Use the JSON block to construct, parse, and output JSON objects—enabling flexible data handling and integration between workflow steps.
What is the JSON Block?
- The JSON block is a data transformation tool that:
- Parses and processes JSON data within Scout workflows
- Dynamically constructs JSON objects using workflow state data
- Enables flexible data formatting for subsequent workflow steps
- Supports Jinja templating for dynamic content generation
- Think of it as your JSON formatter and constructor that can pull data from anywhere in your workflow and structure it exactly how you need it.
How to Use the JSON Block:
- When you add a JSON block to your workflow, you'll see a configuration panel
What Goes in This Field:
- You write your JSON structure directly in this field, but you can include Jinja template variables. Here's what it looks like:

Example with Dynamic Variables
- What you type in the JSON block configuration:
{
"customer_name": {{inputs.name | tojson}},
"sentiment_score": {{sentiment_analysis.confidence | tojson}},
"recommendations": {{recommendation_engine.output | tojson}}
}- The
| tojson
filter is crucial here because it properly escapes characters that would otherwise break JSON syntax when the values are inserted into your template. - Without
| tojson
, you'd run into problems when the input data contains characters that have special meaning in JSON, such as:- Quotes: If
inputs.feedback
containsShe said "this is terrible"
, without| tojson
you'd get:"original_feedback": She said "this is terrible"
- This breaks JSON because the unescaped quotes terminate the string early.
- Quotes: If
- The
- What the workflow state contains:
inputs.name
= John Smithsentiment_analysis.confidence
= 0.85recommendation_engine.output
= ["product_a", "product_b"]
- What the JSON block outputs:
{
"customer_name": "John Smith",
"sentiment_score": 0.85,
"recommendations": ["product_a", "product_b"]
}- The JSON block outputs a parsed JSON object that can be referenced by subsequent blocks using:
{{your_json_block_id.output}}
- What you type in the JSON block configuration:
OR
- You can also access specific fields like so:
{{your_json_block_id.output.customer_name}}
{{your_json_block_id.output.analysis_summary.sentiment}}
Micro-Challenge:
- Use the JSON block to combine the output of two LLM blocks and then save the combined output to a table.
- Use this JSON playground to see it in action.