Object Block
Create an object from input values and a JSON template
Overview
The Object Block creates an object from input values and a JSON template. It automatically escapes input values and inserts them into the template, supporting any data type as input and outputting an object.
Inputs
Input values to be inserted into the JSON template. Input names are dynamically generated from the JSON template based on values wrapped in double curly braces (e.g. {{input}}
). Non-string inputs are automatically converted to strings.
Outputs
The object or array created from the input values and JSON template. The type will be object[]
if the template defines an array, otherwise it will be object
.
Editor Settings
The JSON template for creating the object. Input values are inserted into this template using double curly brace syntax (e.g. {{input}}
). The template must be valid JSON.
Values wrapped in quotes (e.g. "{{input}}"
) will be treated as strings and escaped appropriately. Values without quotes will be inserted directly as JSON values.
The width of the block in pixels.
Whether the block is hidden in the block menu.
Example: Creating an object from multiple inputs
- Add an Object Block and set the JSON Template to:
- Add two Text Blocks with values “John Doe” and “Engineer”. Connect to
name
andjob
inputs. - Add a Number Block with value 30. Connect to
age
input. - Run the flow. The Object Block output will be:
Error Handling
The Object Block will error if:
- The JSON Template is not a valid JSON string
- The interpolated JSON string (after inserting input values) is not valid JSON