Introduction
Sometimes we can store data as a JSON format in our DB2 database and we need to create a new table according to this JSON.
You can see an example for JSON to TABLE conversion DB2 below.
Implementation
First of all we need to keep our data in BSON (Binary JSON) format in DB2 database. If it is not BSON then first we need to convert it to JSON to BSON.
SYSTOOLS.JSON2BSON is converting JSON string to BSON object.
JSON_VAL is converting BSON object to TABLE.
First parameter is our BSON object (myData).
Second parameter is JSON parameter name.
Last parameter is the type of the value (s:40).
