Logmanager documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Decode JSON

This block is used to convert data in JSON format to the dictionary data type. Block containing data in JSON format is connected to the input, in most cases “message” block with “raw” key. Output of this block is a dictionary data type.

Block XML representation

XML representation of decode_json block

<xml xmlns="http://www.w3.org/1999/xhtml">
  <block type="decode_json">
    <value name="JSON">
      <block type="message">
        <field name="OBJECT">raw</field>
      </block>
    </value>
  </block>
</xml>

Example of visual representation

Block "Decode JSON"

Block “Decode JSON”

Example of block usage

Example of "Decode JSON" block

Example of “Decode JSON” block

Block is used on the “set item to” row in the example:

  • loads data from “raw” key of “message” dictionary, created dictionary is saved into the “item” variable,
  • variables “ip” and “user” will appear in the processing result.

Input data

{
  "user": "administrator",
  "ip": "8.8.8.8"
}

Processing results

Results of "Decode JSON" block

Results of “Decode JSON” block