Question & Answer
Question
How to convert a JSON String into JSON type.
Answer
On Demand Consulting
Author: Volodymyr Sitarchuk
Here is the ESQL code to convert JSON String into JSON type
-- initialize the variable with JSON string
DECLARE messageText CHARACTER;
SET messageText = '{"UserName":"test user 1","UpdatedBy":"user2","Details":{"Approved":true,"Initiated":true}}';
-- converting JSON string into JSON object
DECLARE dataAsBit BIT CAST(messageText AS BIT CCSID 1208);
CREATE LASTCHILD OF OutputRoot DOMAIN 'JSON' PARSE(dataAsBit CCSID 1208);
Author: Volodymyr Sitarchuk
Here is the ESQL code to convert JSON String into JSON type
-- initialize the variable with JSON string
DECLARE messageText CHARACTER;
SET messageText = '{"UserName":"test user 1","UpdatedBy":"user2","Details":{"Approved":true,"Initiated":true}}';
-- converting JSON string into JSON object
DECLARE dataAsBit BIT CAST(messageText AS BIT CCSID 1208);
CREATE LASTCHILD OF OutputRoot DOMAIN 'JSON' PARSE(dataAsBit CCSID 1208);
[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSQTW3","label":"IBM On Demand Consulting for Hybrid Cloud"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"","label":""}}]
Was this topic helpful?
Document Information
More support for:
IBM On Demand Consulting for Hybrid Cloud
Software version:
All Versions
Document number:
771879
Modified date:
16 March 2019
UID
ibm10771879
Manage My Notification Subscriptions