parse

This block is part of the value group and was last modified in core v15.0.2.

Type Selection Required

This block requires you to select the data type you want to work with. You must manually select the type using the type selector modal. To access the modal, click the white button on the block.

Field Selection Required

This block requires field selection (out). You must manually select the fields you want to work with using the field selector modal. To access the modal, click the white button on the block.

parse v15.0.2

Converts a JSON in text format to a data structure that can be used inside functions.

In pins 2
  • Stringified value required
  • lenient condition v15.0.2

    Also read JSON the way language models answer it: wrapped in a Markdown code fence or surrounded by text. The first complete JSON object or array is parsed. Off by default.

    Default false

Out pins 2
  • success condition

    Returns true if the value was parsed succesfully.

  • error value

    Error that says why the block failed (only if success is false).

Parses JSON text and emits the result on the type-selected output pin; an unwired stringified pin parses the default "{}". The parsed value is NOT validated against the selected pin type. On parse failure success is false, error carries the parser message, and the selected pin receives an EMPTY OBJECT regardless of the chosen type. lenient (default false) applies only when the input is not valid JSON as it stands: the body of the first Markdown code fence (```json … ``` or ``` … ```, an unclosed fence runs to the end) is parsed, else the first balanced {…} or […] that is valid JSON, skipping any prose around it (Sure! ```json {"a":1} ``` Done -> {"a":1}). A ``` inside a string of a JSON value (code the answer carries) is part of that value, not a fence. It finds JSON, it does not repair it: a broken object is skipped whole and never searched for a valid value nested inside it, so a trailing comma fails with the parser's error, an answer cut off inside an object or a string fails as "never closed" (brackets quoted in a string are never taken as the JSON), a fence holding broken JSON fails even when the prose around it has a bracketed aside, and text with no object or array fails with "no JSON object or array found in the input". With lenient false or unwired the block behaves exactly as without the pin. Use lenient for language-model output instead of stripping fences with value_replace.

json parse
parse json
parse llm json

A typical wiring for parse: get cache key feeds the stringified pin; the error out pin feeds reply in JSON; the success out pin feeds set custom field.

Studio canvas example for the parse block: typical wiring for parse.

Commonly used with

In production blueprints, this block is most often wired together with:

  • get cache key: feeds into this block. gets the key and returns true or false based of its existence, makes it easier for cache-management in flows.
  • reply in JSON: this block feeds into it. Reply to any httpconnection as JSON body.
  • return: this block feeds into it. Returns the added custom pins as data-pins on the function execute.
  • Request: GET: feeds into this block. Performs an HTTP GET request to retrieve data from the specified URL. Returns the response as a string value.
  • set custom field: this block feeds into it.
  • value: feeds into this block. Simply returns the provided value.

Version history

Introduced in v15.0.2.


Back to value Return to the main group to view all sub-groups Back to json Return to the group to view all blocks within this group