FB_JsonReadWriteDataType

FB_JsonReadWriteDataType 1:

In order to use UTF-8 characters, e.g. in the automatic generation of metadata via the function block FB_JsonReadWriteDataType, the check box for the support of UTF-8 in the symbolism must be activated in the TwinCAT project. To do this, double-click on SYSTEM in the project tree, open the Settings tab and activate the corresponding check box.

FB_JsonReadWriteDataType 2:
FB_JsonReadWriteDataType 3:

Strings in UTF-8 format

The variables of type STRING used here are based on the UTF-8 format. This STRING formatting is common for MQTT communication as well as for JSON documents.

In order to be able to receive special characters and texts from a wide range of languages, the character set in the Tc3_IotBase and Tc3_JsonXml libraries is not limited to the typical character set of the data type STRING. Instead, the Unicode character set in UTF-8 format is used in conjunction with the data type STRING.

If the ASCII character set is used, there is no difference between the typical formatting of a STRING and the UTF-8 formatting of a STRING.

Further information on the UTF-8 STRING format and available display and conversion options can be found in the documentation for the Tc2_Utilities PLC library.

FB_JsonReadWriteDataType 4: Outputs

Name

Type

initStatus

HRESULT

FB_JsonReadWriteDataType 5: Methods

Name

Description

FB_JsonReadWriteDataType

Metadata can be added via PLC attributes to the JSON representation of a PLC data structure on an FB_JsonSaxWriter object.

AddJsonKeyValueFromSymbol

Creates the JSON representation of a PLC data structure on an FB_JsonSaxWriter object.

AddJsonValueFromSymbol

Creates the JSON representation of a PLC data structure on an FB_JsonSaxWriter object.

CopyJsonStringFromSymbol

Creates the JSON representation of a symbol and copies it to a variable of data type STRING.

CopyJsonStringFromSymbolProperties

Creates a corresponding JSON representation of PLC attributes on a symbol.

CopySymbolNameByAddress

Returns the complete (ADS) symbol name of a transferred symbol.

GetDataTypeNameByAddress

Returns the data type name of a transferred symbol.

GetJsonFromSymbol

Creates the corresponding JSON representation of a symbol.

GetJsonStringFromSymbol

Creates the corresponding JSON representation of a symbol.

GetJsonStringFromSymbolProperties

Creates a corresponding JSON representation of PLC attributes on a symbol.

GetSizeJsonStringFromSymbol

Reads the size of the JSON representation of a symbol.

GetSizeJsonStringFromSymbolProperties

Reads the size of the JSON representation of PLC attributes on a symbol.

GetSymbolNameByAddress

Returns the complete (ADS) symbol name of a transferred symbol.

SetSymbolFromJson

Extracts a string containing a valid JSON message.

Requirements

TwinCAT version

Hardware

Libraries to be integrated

TwinCAT 3.1, Build 4022

x86, x64, ARM

Tc3_JsonXml