5 Data encoding ToC Previous Next

5.4 OPC UA JSON ToC Previous Next

5.4.8 Unions ToC Previous Next

Unions shall be encoded as JSON objects as shown in Table 34 for the reversible encoding.

Table 34 – JSON Object Definition for a Union

Name Description
SwitchField The identifier for the field in the Union which is encoded as a JSON number.
Value The value of the field encoded using the rules that apply to the data type.

For the non-reversible form, Unions values are encoded using the rule for the current value.

For example, instances of the union:

struct Union1
Byte Selector;

Int32 A;
Double B;
Char* C;

would be represented in reversible form as:

{ "SwitchField":2, "Value":3.1415 }

In non- reversible form, it is represented as:


Previous Next