Posted: Thu May 04, 2017 12:43 am Post subject: Accessing JSON elements via ESQL
Voyager
Joined: 08 Apr 2012 Posts: 97
So, the requirement is pretty simple:
input message:
Code:
{"body": {"SomeRandomName":"SomeRandomValue"}}
Or
Code:
{"body": {"SomeRandomName":1}}
We need to extract the below from this JSON and store into esql char var.
I going crazy as am unable to do it..
can you please help??
i have tried stuff like:
Code:
DECLARE AttrInfo CHARACTER InputRoot.JSON.Data.body.Item[1];
DECLARE AttrInfo CHARACTER InputRoot.JSON.Data.body.Item[1].*;
Code:
DECLARE AttrInfo CHARACTER InputRoot.JSON.Data.body;
can you folks help me get this single line of code set up please?
Using IIB 10.0.04.
I tried this as well,
Code:
SET outputroot.JSON.Data.AttrName = InputRoot.JSON.Data.body;
it gave me this output json in outputroot:
Code:
AttrName .SomeRandomName=1
All i need is a way to extract the JSON attribute SomeRandomName and its value! _________________ - Anurag
------------------------
Be Simple, Be Happy
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum