Was ist JSON?

JSON is short for Java Script Object Notation… 

With the internet and the general networking of computer systems, the need for data exchange has increased ever since. Platform independence is particularly relevant for systems on the web. With JSON (Java Script Object Notation), a very easy-touse, human- and machine-readable data format has become established for data exchange between web-based systems. Here you will find everything necessary for your practical use and the most frequently asked questions about JSON simply explained. Discover everything you need to know about using JSON in our practical example and industrial explanations. 

1. What is JSON?

JSON is an independent data format that is not bound to the JavaScript language. Simultaneously, JSON is the ideal format for exchanging data between systems with its simple structure and encoding in the Unicode character set. It always gets exchanged between applications as a whole. It is the easiest for human processing of a JSON document if the document is available as a file in the filesystem. The file extension “*.JSON” is usually used here. The content of a JSON document is fundamentally object-oriented in structure (see Basic Structure). 

2. How does JSON work?

Formatting the content in a JSON document must follow a strict structure specification. The original specification is made by Douglas Crockford and was documented as a JSON definition. A JSON document always starts and ends with ‘{‘ and ‘}’. The content must be positioned between the curly braces. The curly braces enclose an object. In the document itself, further objects can be defined again. A data field starts with a name followed by the value after a colon. The value can then be an object again. 

Variables stored in JSON can be of the following types: 

Boolean: The truth value can be either true or false. Keywords are used without quotation marks (e.g., “active”: true). 

Number: The numbers are represented with the digits 0-9, optionally with a dot and a sign. It is also possible to use an exponent (e.g., “Distance”: 3.1e+12). 

Strings: A string is any text placed between quotation marks (e.g., “city”: “Hamburg”). 

Zero: An empty variable is indicated by the assignment of zero. That should not be confused with the number 0 or an empty string. Zero means “nothing” (e.g., “linkage”: zero). 

Formatting the content in a JSON document must follow a strict structure specification. The original specification is made by Douglas Crockford and was documented as a JSON definition. A JSON document always starts and ends with ‘{‘ and ‘}’. The content must be positioned between the curly braces. The curly braces enclose an object. In the document itself, further objects can be defined again. A data field starts with a name followed by the value after a colon. The value can then be an object again. 



“Data field1”: “Value” 

“Data object.” 


“Field 1”: 123 

“Field2”: “Text” 

“Field3Array”:[“Value1”, “Value2”, “Value3”, “Value4”] } 


3. What is a JSON-Node?

A JSON node refers to a specific element within a JSON object or array. Each node has a unique path that indicates its position within the JSON structure. The path consists of the name of the object or array in which the node is located, followed by one or more keys that indicate the path to the node.

For example, if we have a JSON structure like this:

“name”: “screws”,
“item number”: 1001 ,
“order”: {
“order_number”: 10013,
“date”: 01.01.2023,
“quantity”: 30

Then “name”, “item number”, “order”, “order number”, “date” and “quantity” are each a JSON node in the structure.

The “name”, “item-number”, and “order” nodes are direct children of the main object, while “order.order-number”, “order.date”, and “order-quantity” are nodes within the “order” object.

JSON nodes are often used to make data in a uniform format and thus readable by other systems and devices.

4. What are the advantages of JSON?

JSON is quick to learn for the user and can be integrated quickly into existing systems. The simple implementation and the short training period are the main advantages of JSON. Additionally, JSON is already readable by many common programming languages. There is a so-called Parser, which translates a JSON file and makes it available for the application. All these points make JSON a popular data format for users. 

Use the advantages of JSON for your project, as well! 

The OPC Router makes it simple to connect JSON via drag & drop – test the full-featured and free demo now. 

5. What is the relation between JSON and Java? 

JSON’s definition originates from a subset of the JavaScript language definition of the ECMA-262 standard. However, the fact that JSON has this origin, and the name “Java Script Object Notation” does not mean that JSON is limited for the use in JavaScript. JSON is completely independent and not tied to the JavaScript language. There are many built-in functions in JavaScript for working with JSON, which makes it particularly easy to use JSON in JavaScript. In many other languages, however, corresponding frameworks are also available. When in doubt, the simple text format of JSON can be read and processed in any programming language. 

6. Which areas of application and practical benefits are there? 

Due to its simplified structure and encoding in the Unicode character set, JSON is the ideal format for exchanging data between systems. And this without having to consider operating systems, computer architectures or programming languages. 

Data is stored in JSON format and transmitted as a data packet to the target system via any channels (http, file, TCP/IP, database, etc.). Due to the structure and the integrated descriptive elements, it is very straightforward to evaluate the data again by the target system. Since the data will exchange as a closed packet/document, it is very suitable for asynchronous processes. JSON is most used in web environments but is establishing itself more and more in various application areas. 

7. How does JSON work in the industry? 

The JSON format is becoming more common in the industrial environment. An important factor is the increasingly close integration of machines and field level devices with web-based technologies. Due to field devices and software systems with REST interfaces (What is REST?) and integration of sensors and devices via MQTT, JSON is already widely used. The current use of NoSQL and the growing trend towards machine learning and artificial intelligence make JSON indispensable as a simple but flexible data format. 

8. Devices and services 

Services that provide information via the REST interface return their data frequently as JSON. An example is the weather service OpenWeatherMap. As an example, this call returns the current weather in London as JSON: https://openweathermap.org/ 

For a detailed example, visit our how-to article on connecting OpenWeatherMap. 

JSON devices are generally data sources that send their data via MQTT and are part of the IoT. 

9. JSON and XML

XML (Extensible Markup Language) is a description language. The description of data is similar in its core to JSON. The description with Tags in XML results in higher workload. Not only can data be described by Tags, but also by Attributes (e.g.: TEXT). As a result, when data is exchanged, the Sender and Receiver must have very explicit information about the agreed structure. 

In contrast, the structure in JSON is flexible and completely understandable by the Receiver in any case and convertible into objects without any prior structure agreement. 

Therefore, XML is suitable for clearly defined data interfaces and JSON for flexible data exchange. 

Let your systems talk to each other via JSON!

Test the OPC Router now in a fully comprehensive and free demo.

10. JSON and MQTT

The MQTT protocol is a simple and lightweight transport protocol for data exchange. It is frequently used by devices and services that have to deal with limited bandwidth and computing capacity. The data format of MQTT is not specified. However, the data payload is frequently formatted as a JSON document since it is ideal for this use case. Due to this reason, there are many MQTT connection partners that publish their data in the form of JSON. 

11. JSON and NoSQL

Document-based databases using the NoSQL concept are a well-known use case for JSON. These databases accept JSON documents for storage and return them for queries. Due to the flexible structure of JSON, it is possible to pass any JSON documents into a document-oriented NoSQL database. Queries in these databases can access all fields and objects in the documents without prior schema definition and therefore return the documents with matching criteria in queries. There is no need for a schema definition as with the traditional SQL. An example of a database like this is the MongoDB database. The OPC Router features a Plug-in to send data to MongoDB databases. 

11. JSON example

A slightly more complex example is explained in the production order with multiple components. The production order is described by some base fields and an Array which contains the components. Each component is described as a separate object with its own description fields. 

"Order number": 4711,
"Quantity": 15000.0,
"Item": "Product A",
"Planned date": "6/4/2020",
"Release": true,
"Name": "Component A",
"Material number": 292345,
"Quantity": 345,123,
"Storage areas": [ 3, 6, 23 ] }, {
"Name": "Component B",
"Material number": 908431,
"Quantity": 12034,123,
"Storage areas": [ 1, 2, 9 ] },
"Name": "Component C",
"Material number": 928398,
"Quantity": 2623.2,
"Storage locations": [ 10 ] },
] }

Simple JSON communication in practice

JSON is a JavaScript-influenced but independent standard in data transmission on the Internet. Due to its simplicity of implementation and ease of interfacing with other programming languages, JSON is a popular data format in the industry. 

In practice, JSON is used frequently for the input or output of parameters in systems. JSON creates a data packet, which can also contain complex and related data, and makes it available as a document for other systems. In industry, for example, production orders can be forwarded quickly in this way to optimize processes. Data packages of this kind can be generated from systems such as SAP, MQTT, OPC UA and SQL using software such as OPC Router and then converted into the JSON structure via a graphical interface. JSON enlivens networking in production and ensures effective Industry 4.0 data exchange.

Further information

OPC UA Plug-in

Read how the JSON plug-in extracts data from different sources, transforms it and thus makes it available for your systems.

STIHL increases overall automation efficiency with OPC Router

Read how the use of the OPC Router from inray at the engine and garden tool manufacturer STIHL increases the overall automation effectiveness. The integration of the ERP system SAP and its database as well as the SQL server of the assembly line enable efficient documentation and traceability of production, as well as automatic process control.

What is industry 4.0

Learn more about Industry 4.0! The fourth industrial revolution through digitalization: people, machines and products are directly networked with each other. Read more in our article!

You can find more interesting articles on the topics of Industry 4.0, cloud, technology, alerting and practical application examples as well as case studies in our Knowledge Base.

Let your systems talk to each other via JSON!

The OPC Router is a software that enables you to connect your systems easily and intuitively via JSON.
Test the OPC Router now in a free and full demo.