The util.JSON class

The util.JSON class provides a basic interface to convert program variable values to/from JSON data.

The util.JSON class is provided in the util C-Extension library. To use the util.JSON class, you must import the util package in your program:

This class does not have to be instantiated; it provides class methods for the current program.

The purpose of the util.JSON class is to convert a JSON string from/to a BDL variable, to interface with other software based on the JSON format.

The BDL variable can be:
  • a simple variable (defined with a primitive type such as DATE, INTEGER, VARCHAR(20))
  • a structured variable (RECORD ... END RECORD)
  • a dynamic array (DYNAMIC ARRAY OF ...)
  • a dictionary (DICTIONARY OF ...)

It is not possible to modify JSON elements with this class. In order to manipulate JSON objects, use the util.JSONObject and util.JSONArray classes.