JSON Utilities SL Library Documentation

Company:

CODESYS

Title:

JSON Utilities SL

Version:

1.11.0.0

Categories:

Application|Utils

Namespace:

JSON

Author:

CODESYS Development GmbH

Placeholder:

JSON_Utilities_SL

Description [1]

With the „JSON Utilities SL“ library, data can be read and written in JSON format from a CODESYS controller.

The ‚JSON Utilities SL‘ library provides the following functionalities:

  • Read JSON files (UTF-8 and UTF-16)

  • Read JSON byte arrays

  • Write JSON files (UTF-8 and UTF-16)

  • Read JSON byte arrays

  • Search for keys, values, and child and parent elements

The data is stored in an array of structures. Data access and element search is performed by means of methods from the JSONData function block. The simple creation of a JSON-File can be realized with funcion block JSONBuilder. The function blocks JSONByteArrayReader and JSONFileReader read data in JSON format and save the values in the JSONData function block. Writing files and byte arrays is performed by means of the function blocks JSONFileWriter and JSONByteArrayWriter.

The package ‚IIoT Libraries SL‘ contains the library „JSON Utilities SL“, the sample project „JSON Utilities SL Example.project“, and a description of the programming interface in CHM format.

You can find the sample project and the CHM file here: C:\Users\USERNAME\JSON Utilities SL\VERSION

Bemerkung

To test the examples on a CODESYS Control Win the files „test_utf16.json“ and „test.json“ can be copied from the target directory of the installation into the directory „c:\temp“.

The sample project provides three applications to demonstrate how to use the library.

Application: JSONArrayExample
In this example, a JSON byte array is read and written. The data is displayed in a visualization.
Application: JSONFileExample
In this example, a JSON file is read and written. The data is displayed in a visualization.
Application: JSONFindValueExample
This example demonstrates how to search for values within a JSON file.
Application: JSONDataExample
This example demonstrates how to generate a JSON string based on two different examples.

Contents:

Indices and tables