By default, DataSet fields can only be decoded to the original DataType by inferring the schema from the JSON message or if the DataSetMetaData describing the DataSet fields is available (i.e. from the DataSetMetaData messages).

Additional information in the payload is required to fully reverse the payload to the original DataTypes for DataSet fields in the following cases where the DataSetMetaData is insufficient to unambiguously decode the messages.

Note that the same problem exists when a field of a nested Structure has DataType BaseDataType or AllowSubTypes =TRUE.

If RawData =FALSE, then the Publisher always includes the full Variant with the UaType or ExtensionObject with UaTypeId when encoding these fields at the top level or within a nested Structure.

If RawData =TRUE the Publisher will encode the Variant but not include the UaTypeId and UaType which means OPC UA DataSetReaders are not able to determine the DataTypes of the original values. If DataSetMetaData contains abstract types and RawData =TRUE is configured, OPC UA DataSetReaders may go into Error state.

Table 186 provides examples of Variant VerboseEncoding field encoding with the different RawData settings. The ValueRank configured for the DataSet field is Scalar if no other ValueRank is mentioned in the description.

Table 187 provides examples of DataValue VerboseEncoding field encoding for RawData=FALSE. For RawData=TRUE the UaType and UaTypeId fields are skipped as shown in Table 186.

Table 186 – DataSet field Variant VerboseEncoding examples

Description

DataType

RawData = TRUE

RawData = FALSE

Simple scalar Int32

Int32

1234

1234

Simple scalar String

String

"Apple"

"Apple"

BaseDataType

BaseDataType

{

"Value": "Apple"

}

{

"UaType": 12,

"Value": "Apple"

}

Structure, no subtypes used

Structure

XInt32

YString

{

"X": 1234,

"Y": "Ring"

}

{

"X": 1234,

"Y": "Ring"

}

Structure using subtype of the DataType in the FieldMetaData

Structure

XInt32

YString

ZDouble

{

"X": 1234,

"Y": "Ring",

"Z": 4.56

}

{

"UaTypeId": "i=3456",

"X": 1234,

"Y": "Ring",

"Z": 4.56

}(a)

Nested structure with BaseDataType field

Structure

XInt32

SStructure

A Double

B BaseDataType

{

"X": 1234,

"S": {

"A": 7.8,

"B": {

"Value":"Apple"

}

}

}

{

"X": 1234,

"S": {

"A": 7.8,

"B": {

"UaType": 12,

"Value":"Apple"

}

}

}

Nested structure with AllowSubtypes = FALSE

Structure

XInt32

SStructure

A Double

B String

{

"X": 1234,

"S": {

"A": 7.8,

"B": "Apple"

}

}

{

"X": 1234,

"S": {

"A": 7.8,

"B": "Apple"

}

}

Nested structure with AllowSubtypes = TRUE

Structure

XInt32

SStructure allow ST

A Double

B String

{

"X": 1234

"S": {

"A": 7.8,

"B": "Apple"

}

}

{

"X": 1234

"S": {

"UaTypeId": "i=5678",

"A": 7.8,

"B": "Apple"

}

}(a)

ValueRank = OneDimension

Int32 [ ]

[1,2,3,4]

[1,2,3,4]

ValueRank = TwoDimensions

Int32 [ ] [ ]

{

"Value": [1,2,3,4],

"Dimensions": [2,2]

}

{

"Value": [1,2,3,4],

"Dimensions": [2,2]

}

ValueRank = ScalarOrOneDimension

Int32

11

11

ValueRank = ScalarOrOneDimension

Int32 [ ]

[1,2,3,4]

[1,2,3,4]

ValueRank = OneOrTwoDimensions

Int32 [ ]

{

"Value": [1,2,3,4]

}

{

"Value": [1,2,3,4]

}

ValueRank = OneOrTwoDimensions

Int32 [ ] [ ]

{

"Value": [1,2,3,4],

"Dimensions": [2,2]

}

{

"Value": [1,2,3,4],

"Dimensions": [2,2]

}

ValueRank = Any

Int32

{

"Value": 11

}

{

"Value": 11

}

ValueRank = Any

Int32 [ ]

{

"Value": [1,2,3,4]

}

{

"Value": [1,2,3,4]

}

ValueRank = Any

Int32 [ ] [ ]

{

"Value": [1,2,3,4],

"Dimensions": [2,2]

}

{

"Value": [1,2,3,4],

"Dimensions": [2,2]

}

Structure with array

Structure

XInt32 [ ]

YString

{

"X": [1,2,3,4],

"Y": "Ring"

}

{

"X": [1,2,3,4],

"Y": "Ring"

}

Structure with multidimensional array

Structure

XInt32 [ ] [ ]

YString

{

"X": {

"Array": [1,2,3,4]

"Dimensions":[2,2]

},

"Y": "Ring"

}

{

"X": {

"Array": [1,2,3,4]

"Dimensions":[2,2]

},

"Y": "Ring"

}

Enumeration

ServerStatusDataType

"Suspended_3"

"Suspended_3"

(a)The NodeIds used in the example for UaTypeId are fictional NodeIds out of the OPC UA namespace to reduce the string length for readability of the examples.

Table 187 – DataSet field DataValue VerboseEncoding examples

Description

DataType

RawData = FALSE

Simple scalar Int32

Int32

{

"Value": 1234,

"SourceTimestamp": "2025-05-26T11:20:07.951Z"

}

Simple scalar String

String

{

"Value": "Apple",

"SourceTimestamp": "2025-05-26T11:20:07.951Z"

}

BaseDataType

BaseDataType

{

"UaType": 12,

"Value": "Apple",

"SourceTimestamp": "2025-05-26T11:20:07.951Z"

}

Structure, no subtypes used

Structure

XInt32

YString

{

"Value": {

"X": 1234,

"Y": "Ring",

}

}

Structure using subtype of the DataType in the FieldMetaData

Structure

XInt32

YString

ZDouble

{

"Value": {

"UaTypeId": "nsu=http://xy.de/types;i=123",

"X": 1234,

"Y": "Ring",

"Z": 4.56

}

}