Teacher: Birgitta Hauser

Title: Generating JSON Documents with SQL (SQL and JSON – Part 1 of 2)
Abstract: JSON (Java Script Online Notation) is a data exchange format like XML, however JSON is simpler, less verbose and can be faster parsed than XML. In this way JSON becomes more and more important especially when data is  exchanged by RESTful web services. The use of XML declines in favor of JSON. With Release 7.3 TR 3 a bunch of scalar and aggregate functions were integrated into SQL, for generating JSON objects, arrays and for combining JSON  components into complete documents. The focus of this session is to generate JSON documents.

Learning Objectives:
Get an introduction into JSON basics. Learn how JSON object and arrays can be generated, concatenated or nested and composed into JSON documents.


Audience: Developers and users who are experienced in SQL Queries and need to create JSON documents for data exchange.

Level: Advanced

Duration: Single Session


  • JSON Basics

  • JSON Support in SQL for Db2 for i

  • Data Type Conversion

  • Generating (nested) Objects

  • Generating Arrays

    • Listing Values (Strings, Numbers, Objects, Arrays, true, false, null)

    • Based on a SELECT-Statement

  •  Accumulating JSON Values over multiple Rows into Arrays

  •  Generating complex JSON Data

  • RPG-Program for exchanging JSON Data over the Web