TB_ArrayToJson

Representation in FBD

General Information

The function block converts two arrays (key and value array; data type: STRING_128_ARRAY) into a JSON string. This is placed in a byte array (BYTE_4096_BMARRAY) by the function block. Each byte is a character/letter in the JSON string.

Recommended task: Cyclic, Default
Libraries used: BM_TYPES_40bd04 or higher
TECH_TYPES_40bd15 or higher

General description

The general description explains the JSON format in more detail and provides an integration example.

  • Click here for more information>
  • InOut Parameter

    none

    Input Parameter

    Marking: Data type: Description:
    x_Execute BOOL Execute the function block
    a_Keys STRING_128_ARRAY Array of keys; in JSON format, keys are the variable names
    a_Values STRING_128_ARRAY Array of the values associated with the keys

    Output Parameter

    Marking: Data type: Description:
    x_Busy BOOL Function is working
    x_Done BOOL Function is done and ready for a new measurement
    a_JsonData BYTE_4096_BMARRAY Converted keys and values into a JSON string in a byte array