JSON (JavaScript Object Notation) is a file format that has become fairly common in the industrial automation industry for storing data or information (including such things as configuration files). But also as one of the most common data formats used by RESTful APIs and web services, which are commonly used for providing a range of useful information including energy prices and weather data.
Sometimes, of course, depending on the application, some or all components of JSON packet might be variable or dynamic in nature, which can make it difficult for off-the-shelf industrial software solutions to properly parse the information from those packets.
In this post, I will cover step-by-step how to leverage the scripting capabilities of the OPC Router to access and parse JSON packets either from a JSON file saved to a specific file directory or from a RESTful web service after which that data can be used with any of the other connectors that OPC Router supports. For this example, we log the data to a SQL database.