FB_JsonSaxPrettyWriter

FB_JsonSaxPrettyWriter 1:

This function block has a difference from FB_JsonSaxWriter: it adds matching whitespaces for better readability of a JSON document.

FB_JsonSaxPrettyWriter 2:

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.

Syntax

FUNCTION_BLOCK FB_JsonSaxPrettyWriter
VAR_OUTPUT
  initStatus     : HRESULT;
END_VAR

FB_JsonSaxPrettyWriter 3: Outputs

Name

Type

initStatus

HRESULT

FB_JsonSaxPrettyWriter 4: Methods

Name

Description

SetFormatOptions

Adjusts the general formatting options for an instance of the [<=>] FB_JsonSaxPrettyWriter.

SetIndent

Customizes the indentation.

All other methods can be found at FB_JsonSaxWriter.

Requirements

TwinCAT version

Hardware

Libraries to be integrated

TwinCAT 3.1, Build 4022

x86, x64, ARM

Tc3_JsonXml