Modifier Blocks
To JSON Block
Convert any value into a JSON string representation
Overview
The To JSON Block converts any input value into its JSON string representation. This is useful for serializing data structures, debugging, or preparing data for storage or transmission in a text format.
Key Features
- Converts any JavaScript value to a JSON string
- Preserves data structure and types
- Handles complex nested objects and arrays
- Useful for data serialization and debugging
Inputs
The value to convert to JSON. Can be any type including objects, arrays, strings, numbers, booleans, or null.
Outputs
The JSON string representation of the input value.
Example: Convert an Object to JSON
- Create an Object Block with values:
- Add a To JSON Block and connect the Object Block to its
input
. - Run the flow. The output will be the stringified JSON:
Error Handling
- Handles circular references by throwing an error
- Non-JSON-serializable values (like functions) will be omitted
- Undefined values will be omitted from objects