How To Articles > How to Insert OPC UA Data into a JSON Structure

How to Insert OPC UA Data into a JSON Structure

How to Insert OPC UA Data into a JSON Structure

Open Automation Software Tags can be defined to connect to OPC UA Servers with the built in OPC UA Driver Interface. This tutorial walks you though downloading and installing OAS, configuring an OPC UA driver, configuring tags and storing them as JSON packets. You may want to start by reading our What is JSON article.

Step 1. Download and Install the Open Automation Software and Start the OAS Service

If you have not already done so, you will need to download and install the OAS platform.  Fully functional trial versions of the software are available for Windows, Windows IoT Core, Linux, Raspberry Pi and Docker on our downloads page.

On Windows run the downloaded Setup.exe file to install one or more of the Open Automation Software features. Select the default Typical installation if you are not sure what features to use or the Custom installation if you want to save disk space on the target system.  When prompted agree to the End User License Agreement to continue the installation.

For more detailed instructions and video tutorials, visit the installation guide for your system:
Windows Installation | Linux Installation | Raspberry Pi Installation | Dockers Installation

When the installation is finished the OAS Service Control application will appear.  Use this application to start the 4 Services. If this is the first time installing the software it will automatically enter Runtime with an example Tag Configuration.

Step 2. Configure Your OPC UA Data Source

  1. First, you will need to open the Configure OAS application from the program group Open Automation Software.

  2. Select Configure >> License from the top menu and verify that OPC UA is one of the available Drivers in the lower left of the form. The demo license will have this by default. If you do not see OPC UA available, contact to update your license.

  3. Select Configure >> Drivers from the top menu.

  4. Select localhost or the remote service you wish to modify with the Select button to the right of the Network Node list.

  5. The Configure Drivers Screen will appear. Select Siemens from the Driver dropdown box.

  6. Enter a meaningful Driver Interface Name that you will refer to this physical connection when defining Tags with a OPC UA Data Source.

  7. Define the properties for the desired physical connection.

  8. Click the Add Driver button above the Driver list in the left pane to add the Driver Interface as an available selection when defining Tags in the next step.

For more detailed instructions on configuring your OPC DA data source, click here to see our Getting Started OPC UA tutorial.

Step 3. Configure Your Tags

OAS provides multiple ways to add and define tags:

To add a Tag manually:

  1. In the OAS Configure Application, select Configure >> Tags from the top menu.

  2. Select localhost or the remote service you wish to modify with the Select button to the right of the Network Node list.

  3. Click on the Add Tag button located at the top of the Tag browser on the left portion of the screen.

  4. A dialog box will appear. Enter a name for your new tag and click ok.

  5. A configuration screen will appear for your new tag. Select your data source type in in the Data Source dropdown box.

  6. Specify the correct data type in the Data Type dropdown box.

  7. Click Apply Changes at the bottom right of the window.

For more detailed instructions on configuring your tags, click here to see our Getting Started Tags tutorial.

Step 4. Insert Tag Data into a JSON Structure

Create a new tag and set it’s Data Type and Data Source to JSON. Click Ok.

json data source

Click the Edit Value button next to the Structure input field.

json structure

Enter in your JSON structure.

"pump": false,
"tanks": [
"room": 1,
"level": null,
"flowrate": null,
"room": 2,
"level": null,
"flowrate": null,

Click the Add button.

json add

The tag browser will open. Select your Network Node. Select the tag and it’s property that you want to fill your key/value pair with. In the Key field enter the key you want to reference. Do this for each key/value pair that you want to fill.

json browse

After you are done adding your tags, your results will look like:

json keys

Click Apply Changes.

For more detailed instructions, see the JSON Data Source article in our knowledge base.