Articles on: Blocks Creator
This article is also available in:

⬜ 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 the name and age outputs.


πŸ“€ 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


  1. An API Request block queries an external service to obtain a user's data in JSON format.
  2. The API result is stored in a variable responseApi containing {"name": "Alice", "age": 28, "estSubscribe": true}.
  3. The Decode JSON block is configured with:
  • json: responseApi
  • schema: {"name": "Example", "age": 0, "isSubscriber": false}
  1. The block automatically generates the outputs name (Text), age (Number) and isSubscriber (Boolean).
  2. 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: null for objects, 0 for numbers).
  • Error handling: In case of decoding error (invalid JSON), the out stream is not activated. Use a Handle Error block to capture this case.

Updated on: 04/03/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!