The JSON DataEncodingwas developed to allow OPC UA applications to interoperate with web and enterprise software that use this format. The OPC UA JSON DataEncodingdefines standard JSON representations for all OPC UA Built-In types.

The JSON format is defined in RFC 7159. It is partially self-describing because each field has a name encoded in addition to the value, however, JSON has no mechanism to qualify names with namespaces.

The JSON format does not have a published standard for a schema that can be used to describe the contents of a JSON document. However, the schema mechanisms defined in this specification can be used to describe JSON documents. Specifically, the DataTypeDescriptionstructure defined in OPC 10000-3can define any JSON document that conforms to the rules described below.

Serversthat support the JSON DataEncodingshall add DataTypeEncoding Nodescalled “Default JSON” to all DataTypeswhich can be serialized with the JSON encoding. The NodeIdsof these Nodesare defined by the information model which defines the DataType. These NodeIdsare used in ExtensionObjectsas described in

There are two important use cases for the JSON encoding: Cloud applications which consume PubSubmessages and JavaScript Clients(JSON is the preferred serialization format for JavaScript). For theCloud application use case, the PubSubmessage needs to be self-contained which implies it cannot contain numeric references to an externally defined namespace table. Cloud applications also often rely on scripting languages to process the incoming messages so artefacts in the DataEncodingthat exist to ensure fidelity during decoding are not necessary. For this reason, this DataEncodingdefines a ‘non-reversible’ form which is designed to meet the needs of Cloud applications. Applications, such as JavaScript Clients, which use the DataEncodingfor communication with other OPC UA applications use the normal or ‘reversible’ from. The differences, if any, between the reversible and non-reversible forms are described for each type.