Skip to main content
Destructure Block Screenshot

Overview

The Destructure Block is used to extract multiple values from an object or array at once. It uses JSONPath notation to navigate through the input value and extract the values at the specified paths. This block is similar to the Extract Object Path Block, but it allows you to specify multiple paths and extract multiple values at once, which can be more convenient than using multiple Extract Object Path blocks.

Inputs

TitleData TypeDescriptionDefault ValueNotes
ObjectobjectThe object to extract values from.(required)

Example 1: Extract multiple properties from an object

  1. Create an Object Block and set the value to the following:
    {
      "name": "John Doe",
      "age": 30,
      "job": "Engineer"
    }
    
  2. Create a Destructure Block and set the Paths to $.name, $.age, and $.job.
  3. Connect the Object Block to the Object input of the Destructure Block.
  4. Run the flow. The Destructure Block should have three outputs: $.name with the value John Doe, $.age with the value 30, and $.job with the value Engineer.
Destructure Block Example 1

Error Handling

If a path is invalid or does not exist in the input object, the corresponding output port will not be run.

FAQ

Q: How is the Destructure Block different from the Extract Object Path Block? A: The Destructure Block is similar to the Extract Object Path Block, but it allows you to specify multiple paths and extract multiple values at once. This can be more convenient than using multiple Extract Object Path blocks to extract multiple paths. The Destructure Block does not allow you specify a path and extract every value at that path, which is possible with the Extract Object Path Block. Q: Can I use the Destructure Block to extract array values? A: Yes, you can use the Destructure Block to extract array values, but only with a known length. You can use paths such as $[0], $[1], etc. to extract values from an array. However, you cannot use paths such as $[*] or $[?] to extract all values from an array. Q: What happens if a path does not exist in the input object? A: If a path does not exist in the input object, the corresponding output port will not be run.

See Also