7.2.5.4.3 VerboseEncoding and abstract type handling

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.

DataSet fields with BuiltInType ExtensionObject and a value which is a subtype of the DataType in the FieldMetaData. The UaTypeId is needed to decode the value.

DataSet fields with BuiltInType Variant. The UaType is needed to decode the value.

DataSet fields with abstract ValueRank values of Any (-2) or OneOrMoreDimensions (0)

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 Int32Int32 1234 1234
Simple scalar StringString "Apple" "Apple"
BaseDataTypeBaseDataType { "Value": "Apple" } { "UaType": 12, "Value": "Apple" }
Structure, no subtypes used

Structure

X Int32

Y String

{ "X": 1234, "Y": "Ring" } { "X": 1234, "Y": "Ring" }
Structure using subtype of the DataType in the FieldMetaData

Structure

X Int32

Y String

Z Double

{ "X": 1234, "Y": "Ring", "Z": 4.56 } { "UaTypeId": "i=3456", "X": 1234, "Y": "Ring", "Z": 4.56 }(a)
Nested structure with BaseDataType field

Structure

X Int32

S Structure

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

X Int32

S Structure

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

X Int32

S Structure 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 = OneDimensionInt32 [ ] [1,2,3,4] [1,2,3,4]
ValueRank = TwoDimensionsInt32 [ ] [ ] { "Value": [1,2,3,4], "Dimensions": [2,2] } { "Value": [1,2,3,4], "Dimensions": [2,2] }
ValueRank = ScalarOrOneDimensionInt32 11 11
ValueRank = ScalarOrOneDimensionInt32 [ ] [1,2,3,4] [1,2,3,4]
ValueRank = OneOrTwoDimensionsInt32 [ ] { "Value": [1,2,3,4] } { "Value": [1,2,3,4] }
ValueRank = OneOrTwoDimensionsInt32 [ ] [ ] { "Value": [1,2,3,4], "Dimensions": [2,2] } { "Value": [1,2,3,4], "Dimensions": [2,2] }
ValueRank = AnyInt32 { "Value": 11 } { "Value": 11 }
ValueRank = AnyInt32 [ ] { "Value": [1,2,3,4] } { "Value": [1,2,3,4] }
ValueRank = AnyInt32 [ ] [ ] { "Value": [1,2,3,4], "Dimensions": [2,2] } { "Value": [1,2,3,4], "Dimensions": [2,2] }
Structure with array

Structure

X Int32 [ ]

Y String

{ "X": [1,2,3,4], "Y": "Ring" } { "X": [1,2,3,4], "Y": "Ring" }
Structure with multidimensional array

Structure

X Int32 [ ] [ ]

Y String

{ "X": { "Array": [1,2,3,4] "Dimensions":[2,2] }, "Y": "Ring" } { "X": { "Array": [1,2,3,4] "Dimensions":[2,2] }, "Y": "Ring" }
EnumerationServerStatusDataType "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 Int32Int32 { "Value": 1234, "SourceTimestamp": "2025-05-26T11:20:07.951Z" }
Simple scalar StringString { "Value": "Apple", "SourceTimestamp": "2025-05-26T11:20:07.951Z" }
BaseDataTypeBaseDataType { "UaType": 12, "Value": "Apple", "SourceTimestamp": "2025-05-26T11:20:07.951Z" }
Structure, no subtypes used

Structure

X Int32

Y String

{ "Value": { "X": 1234, "Y": "Ring", } }
Structure using subtype of the DataType in the FieldMetaData

Structure

X Int32

Y String

Z Double

{ "Value": { "UaTypeId": "nsu=http://xy.de/types;i=123", "X": 1234, "Y": "Ring", "Z": 4.56 } }