Inferensys

Glossary

JSON Encoding

A text-based, human-readable serialization format defined by OPC UA that encodes data structures as JavaScript Object Notation, commonly used with web-friendly transports.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
DATA SERIALIZATION FORMAT

What is JSON Encoding?

JSON Encoding is a text-based, human-readable serialization format defined by the OPC UA specification that encodes data structures as JavaScript Object Notation, primarily used with web-friendly transports like MQTT and HTTPS.

JSON Encoding is one of two standard OPC UA serialization formats, alongside UA Binary Encoding. It maps OPC UA DataSet messages and service payloads into JSON text, making them directly consumable by web applications, cloud platforms, and RESTful APIs without requiring proprietary binary parsers. This format is mandatory for OPC UA PubSub over MQTT and HTTPS transports.

While less compact than binary encoding, JSON offers superior interoperability with IT systems. It supports both reversible encoding, which preserves full OPC UA type information for round-tripping, and non-reversible encoding, which simplifies data for generic JSON consumers. The format is defined in Part 6 of the OPC UA specification.

DATA SERIALIZATION

Key Features of JSON Encoding

JSON encoding is a lightweight, text-based data interchange format defined by the OPC UA specification for use with web-friendly transports. It structures data as human-readable JavaScript Object Notation, enabling interoperability between industrial automation systems and modern cloud applications.

01

Human-Readable Structure

JSON encoding represents OPC UA data as key-value pairs and ordered arrays in plain text. Unlike the compact UA Binary Encoding, JSON is self-describing and can be inspected directly in a text editor or browser developer console.

  • Uses UTF-8 character encoding for universal compatibility
  • Structures complex Node attributes and DataSets as nested objects
  • Enables debugging without specialized protocol analyzers
  • Ideal for RESTful APIs and webhook integrations
02

Reversible Encoding

JSON encoding provides a lossless, bidirectional mapping between OPC UA data structures and their JSON representation. Every encoded message can be decoded back to its original Variant type without ambiguity.

  • Preserves StatusCode and timestamp metadata alongside values
  • Handles arrays, matrices, and multi-dimensional structures
  • Supports the full OPC UA Built-in Type system, including Guid, DateTime, and ByteString
  • Maintains Namespace and NodeId integrity across serialization boundaries
03

Transport Protocol Flexibility

JSON encoding is the preferred format for OPC UA communication over WebSockets and HTTPS, making it essential for cloud connectivity and browser-based dashboards.

  • Used extensively with OPC UA PubSub over MQTT for IoT integrations
  • Compatible with standard HTTP Content-Type: application/json headers
  • Enables firewall-friendly communication on port 443
  • Supports stateless request-response patterns via RESTful OPC UA gateways
04

Compact and Non-Compact Modes

The OPC UA specification defines two JSON encoding variants to balance readability against payload size.

  • Non-Reversible (Verbose): Uses human-friendly property names like "Value" and "StatusCode", maximizing readability for debugging
  • Reversible (Compact): Employs abbreviated numeric field identifiers to minimize bandwidth, suitable for high-throughput production environments
  • Both modes conform to RFC 8259 and ECMA-404 standards
  • The DataSetMessage header indicates which encoding mode is in use
05

Native Web Ecosystem Integration

Because JSON is the lingua franca of web development, OPC UA JSON encoding eliminates the need for custom parsing libraries in cloud applications.

  • Directly consumable by JavaScript, Python, and Node.js applications
  • Compatible with AWS IoT Core, Azure IoT Hub, and Google Cloud IoT
  • Enables serverless function processing of industrial telemetry
  • Simplifies integration with time-series databases like InfluxDB and TimescaleDB
06

DataSetMessage Mapping

In the PubSub model, JSON encoding defines how a DataSet is serialized into a DataSetMessage for distribution to subscribers.

  • Each DataSetWriter specifies JSON as its MessageMapping
  • Field values are encoded as a JSON object with name-value pairs
  • Supports DeltaFrame messages that transmit only changed values
  • The NetworkMessage envelope wraps one or more DataSetMessages with routing metadata
SERIALIZATION FORMAT COMPARISON

JSON Encoding vs. UA Binary Encoding

A technical comparison of the two OPC UA data serialization formats, evaluating their suitability for different industrial communication scenarios.

FeatureJSON EncodingUA Binary Encoding

Format Type

Text-based (UTF-8)

Binary stream

Human Readability

Payload Size

Larger (verbose syntax)

Compact (minimal overhead)

Encoding/Decoding Speed

Slower (text parsing)

Faster (direct memory mapping)

Native Web Compatibility

Transport Protocol Pairing

HTTPS, WebSocket, MQTT

UA TCP, TSN

Schema Validation Overhead

Higher (string-based)

Lower (binary structure)

Use Case

Cloud integration, web dashboards, RESTful APIs

High-speed automation, controller-to-controller, deterministic fieldbus

JSON ENCODING

Frequently Asked Questions

Clear, technical answers to the most common questions about OPC UA's JSON data serialization format, its structure, and its role in modern industrial interoperability.

JSON Encoding in OPC UA is a text-based, human-readable data serialization format that represents structured information from the OPC UA Address Space as JavaScript Object Notation (JSON) as defined in RFC 8259. Unlike the compact UA Binary Encoding, JSON Encoding prioritizes interoperability with web-friendly transports and RESTful APIs by converting typed Nodes, their attributes, and values into key-value pairs and arrays. This encoding is formally specified in Part 6 of the OPC UA standard and supports two primary profiles: Non-Reversible JSON, which omits specific type metadata for simplicity, and Reversible JSON, which includes namespace URIs, server indexes, and data type identifiers to allow a receiver to perfectly reconstruct the original binary structure. It is the default encoding for the HTTPS transport and is commonly paired with OPC UA PubSub over MQTT to publish DataSet messages directly to cloud brokers like AWS IoT or Azure Event Grid without requiring proprietary binary parsers.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.