β¬ Decode JSON
β¬ Decode JSON
The Decode JSON block allows you to transform data in JSON text format (often from API or Webhooks) into individual variables that can be used in other Celestory blocks (Text, Number, Boolean, List, etc.).
This block is particularly useful for extracting structured information from API responses or external data, and making it accessible as typed output.
π₯ Entries
- json (Text): The text in JSON format to decode. This content must match the structure defined in the schema.
- schema (Text): An example of JSON used as a template to generate the outputs. Example:
{"name": "John", "age": 30}will automatically create thenameandageoutputs.
π€ Outings
- out (Stream): The output stream that activates once decoding is complete.
- [Schema Keys] (Variable): For each key present in the schema, a corresponding output is generated with the appropriate type (Text, Number, Boolean, or List).
π‘ Example of use
Scenario: Retrieve user information from an API
- An API Request block queries an external service to obtain a user's data in JSON format.
- The API result is stored in a variable
responseApicontaining{"name": "Alice", "age": 28, "estSubscribe": true}. - The Decode JSON block is configured with:
json:responseApischema:{"name": "Example", "age": 0, "isSubscriber": false}
- The block automatically generates the outputs
name(Text),age(Number) andisSubscriber(Boolean). - The outputs are connected to a Show a message block to display: "The user Alice is 28 years old and is subscribed: true".
βοΈ Technical Details
- Dynamic generation of outputs: Outputs are created automatically based on the diagram provided. Their type is deduced from the example value (ex:
"text"β Text,42β Number,trueβ Boolean). - JSON validation: If the input JSON does not match the schema, the generated outputs will return default values ββ(eg:
nullfor objects,0for numbers). - Error handling: In case of decoding error (invalid JSON), the
outstream is not activated. Use a Handle Error block to capture this case.
Updated on: 04/03/2026
Thank you!
