Errata exists for this version of the document.

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;

}

Value;

};

would be represented in reversible form as:

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

In non- reversible form, it is represented as:

3.1415