Any value for a Built-In type that is NULL shall be encoded as the JSON literal ‘null’ if the value is an element of an array. If the NULL value is a field within a Structureor Union, the field shall not be encoded.

A Booleanvalue shall be encoded as the JSON literal ‘true’ or ‘false’.

Integer values other than Int64and UInt64shall be encoded as a JSON number.

Int64and UInt64values shall be formatted as a decimal number encoded as a JSON string

(See the XML encoding of 64-bit values described in 5.3.1.3).

Normal Floatand Doublevalues shall be encoded as a JSON number.

Special floating-point numbers such as positive infinity (INF), negative infinity (-INF) and not-a-number (NaN) shall be represented by the values “Infinity”, “-Infinity” and “NaN” encoded as a JSON string. See 5.2.2.3for more information on the different types of special floating-point numbers.

Stringvalues shall be encoded as JSON strings.

Any characters which are not allowed in JSON strings are escaped using the rules defined in RFC 7159.

DateTimevalues shall be formatted as specified by ISO 8601:2004and encoded as a JSON string.

DateTimevalues which exceed the minimum or maximum values supported on a platform shall be encoded as “0001-01-01T00:00:00Z” or “9999-12-31T23:59:59Z” respectively. During decoding, these values shall be converted to the minimum or maximum values supported on the platform.

DateTimevalues equal to “0001-01-01T00:00:00Z” are considered to be NULL values.

Guidvalues shall be formatted as described in 5.1.3and encoded as a JSON string.

ByteStringvalues shall be formatted as a Base64text and encoded as a JSON string.

Any characters which are not allowed in JSON strings are escaped using the rules defined in RFC 7159.

XmlElementvalue shall be encoded as a String as described in 5.4.2.5.

NodeIdvalues shall be encoded as a JSON object with the fields defined in Table 23.

The abstract NodeId structure is defined in OPC 10000-3and has three fields Identifier, IdentifierTypeand NamespaceIndex. The representation these abstract fields are described in the table.

Table 23– JSON Object Definition for a NodeId

Name

Description

IdType

The IdentifierTypeencoded as a JSON number.

Allowed values are:

0 - UInt32 Identifierencoded as a JSON number.

1 - A StringIdentifier encoded as a JSON string.

2 - A Guid Identifierencoded as described in 5.4.2.7.

3 - A ByteString Identifierencoded as described in 5.4.2.8.

This field is omitted for UInt32 identifiers.

Id

The Identifier.

The value of the id field specifies the encoding of this field.

Namespace

The NamespaceIndexfor the NodeId.

The field is encoded as a JSON number for the reversible encoding.

The field is omitted if the NamespaceIndexequals 0.

For the non-reversible encoding, the field is the NamespaceUriassociated with the NamespaceIndex,encoded as a JSON string.

A NamespaceIndex of 1 is always encoded as a JSON number.

ExpandedNodeIdvalues shall be encoded as a JSON object with the fields defined in Table 24.

The abstract ExpandedNodeId structure is defined in OPC 10000-3and has five fields Identifier, IdentifierType, NamespaceIndex, NamespaceUri and ServerIndex. The representation of these abstract fields are described in the table.

Table 24– JSON Object Definition for an ExpandedNodeId

Name

Description

IdType

The IdentifierTypeencoded as a JSON number.

Allowed values are:

0 - UInt32 Identifierencoded as a JSON number.

1 - A StringIdentifier encoded as a JSON string.

2 - A Guid Identifierencoded as described in 5.4.2.7.

3 - A ByteString Identifierencoded as described in 5.4.2.8.

This field is omitted for UInt32 identifiers.

Id

The Identifier.

The value of the ‘t’ field specifies the encoding of this field.

Namespace

The NamespaceIndexor the NamespaceUrifor the ExpandedNodeId.

If the NamespaceUriis not specified, the NamespaceIndexis encoded with these rules:

The field is encoded as a JSON number for the reversible encoding.

The field is omitted if the NamespaceIndexequals 0.

For the non-reversible encoding the field is the NamespaceUriassociated with the NamespaceIndexencoded as a JSON string.

A NamespaceIndex of 1 is always encoded as a JSON number.

If the NamespaceUriis specified it is encoded as a JSON string in this field.

ServerUri

The ServerIndexfor the ExpandedNodeId.

This field is encoded as a JSON number for the reversible encoding.

This field is omitted if the ServerIndexequals 0.

For the non-reversible encoding, this field is the ServerUriassociated with the ServerIndexportion of the ExpandedNodeId,encoded as a JSON string.

StatusCodevalues shall be encoded as a JSON number for the reversible encoding.

For the non-reversible form, StatusCodevalues shall be encoded as a JSON object with the fields defined in Table 25.

Table 25– JSON Object Definition for a StatusCode

Name

Description

Code

The numeric code encoded as a JSON number.

The Codeis omitted if the numeric code is 0 (Good).

Symbol

The string literal associated with the numeric code encoded as JSON string.

e.g. 0x80AB0000 has the associated literal “BadInvalidArgument”.

The Symbolis omitted if the numeric code is 0 (Good).

A StatusCode of Good (0) is treated like a NULL and not encoded. If it is an element of an JSON array it is encoded as the JSON literal ‘null’.

DiagnosticInfovalues shall be encoded as a JSON object with the fields shown in Table 26.

Table 26– JSON Object Definition for a DiagnosticInfo

Name

Data Type

Description

SymbolicId

Int32

A symbolic name for the status code.

NamespaceUri

Int32

A namespace that qualifies the symbolic id.

Locale

Int32

The locale used for the localized text.

LocalizedText

Int32

A human readable summary of the status code.

AdditionalInfo

String

Detailed application specific diagnostic information.

InnerStatusCode

StatusCode

A status code provided by an underlying system.

InnerDiagnosticInfo

DiagnosticInfo

Diagnostic info associated with the inner status code.

Each field is encoded using the rules defined for the built-in type specfied in the Data Type column.

The SymbolicId, NamespaceUri, Localeand LocalizedTextfields are encoded as JSON numbers which reference the StringTablecontained in the ResponseHeader.

QualifiedNamevalues shall be encoded as a JSON object with the fields shown in Table 27.

The abstract QualifiedName structure is defined in OPC 10000-3and has two fields Nameand NamespaceIndex. The NamespaceIndexis represented by the Urifield in the JSON object.

Table 27– JSON Object Definition for a QualifiedName

Name

Description

Name

The Name component of the QualifiedName.

Uri

The NamespaceIndexcomponent of the QualifiedNameencoded as a JSON number.

The Urifield is omitted if the NamespaceIndex equals 0.

For the non-reversible form, the NamespaceUriassociated with the NamespaceIndexportion of the QualifiedNameis encoded as JSON string unless the NamespaceIndexis 1 or if NamespaceUriis unknown. In these cases, the NamespaceIndexis encoded as a JSON number.

LocalizedTextvalues shall be encoded as a JSON object with the fields shown in Table 28.

The abstract LocalizedText structure is defined in OPC 10000-3and has two fields Textand Locale.

Table 28– JSON Object Definition for a LocalizedText

Name

Description

Locale

The Localeportion of LocalizedTextvalues shall be encoded as a JSON string

Text

The Textportion of LocalizedTextvalues shall be encoded as a JSON string.

For the non-reversible form, LocalizedTextvalue shall be encoded as a JSON string containing the Textcomponent.

ExtensionObjectvalues shall be encoded as a JSON object with the fields shown in Table 29.

Table 29– JSON Object Definition for a ExtensionObject

Name

Description

TypeId

The NodeIdof a DataTypeEncoding Nodeformatted using the rules in 5.4.2.10.

Encoding

The format of the Bodyfield encoded as a JSON number.

This value is 0 if the body is Structureencoded as a JSON object (see 5.4.6).

This value is 1 if the body is a ByteStringvalue encoded as a JSON string (see 5.4.2.8).

This value is 2 if the body is a XmlElementvalue encoded as a JSON string (see 5.4.2.9).

This field is omitted if the value is 0.

Body

Bodyof the ExtensionObject. The type of this field is specified by the Encodingfield.

If the Body is empty, the ExtensionObjectis NULL and is omitted or encoded as a JSON null.

For the non-reversible form, ExtensionObjectvalues shall be encoded as a JSON object containing only the value of the Bodyfield. The TypeIdand Encodingfields are dropped.

Variantvalues shall be encoded as a JSON object with the fields shown in Table 30.

Table 30– JSON Object Definition for a Variant

Name

Description

Type

The Built-in type for the value contained in the Body(see Table 1) encoded as JSON number.

If type is 0 (NULL) the Variantcontains a NULL value and the containing JSON object shall be omitted or replaced by the JSON literal ‘null’ (when an element of a JSON array).

Body

If the value is a scalar it is encoded using the rules for type specified for the Type.

If the value is a one-dimensional array it is encoded as JSON array (see 5.4.5).

Multi-dimensional arrays are encoded as a one dimensional JSON array which is reconstructed using the value of the Dimensionsfield (see 5.2.2.16).

Dimensions

The dimensions of the array encoded as an JSON array of JSON numbers.

The Dimensionsare omitted for scalar and one-dimensional array values.

For the non-reversible form, Variantvalues shall be encoded as a JSON object containing only the value of the Bodyfield. The Typeand Dimensionsfields are dropped. Multi-dimensional arrays are encoded as a multi dimensional JSON array as described in 5.4.5.

DataValuevalues shall be encoded as a JSON object with the fields shown in Table 31.

Table 31– JSON Object Definition for a DataValue

Name

Data Type

Description

Value

Variant

The value.

Status

StatusCode

The status associated with the value.

SourceTimestamp

DateTime

The source timestamp associated with the value.

SourcePicoSeconds

UInt16

The number of 10 picosecond intervals for the SourceTimestamp.

ServerTimestamp

DateTime

The Servertimestamp associated with the value.

ServerPicoSeconds

UInt16

The number of 10 picosecond intervals for the ServerTimestamp.

If a field has a null or default value it is omitted. Each field is encoded using the rules defined for the built-in type specfied in the Data Type column.