|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
JSON Nested Arrays in ESQL |
« View previous topic :: View next topic » |
Author |
Message
|
soudhanya |
Posted: Mon Oct 01, 2018 6:02 am Post subject: JSON Nested Arrays in ESQL |
|
|
Novice
Joined: 27 Feb 2017 Posts: 20
|
Hi,
Can some one help me how to create nested Arrays..
Here is the JSON message:
{"name": "DiwRule3", "contactFilterRules": [
{
"contactFieldId": 16,
"type": "SYSTEM_ARRAY",
"operator": "IN",
"dataType": "NUMBER",
"columnName": "groups",
"contactFilterOption": "IN",
"columnValue": [
8105621194808290, 8105621194808291
]
}]
}
I had a hard time to create ColumnValue array
here is my ESQL:
SET OutputRoot.JSON.Data.name = UPPER(Environment.DFDL.ns:ContactEmployeeDetails.Group);
CREATE FIELD OutputRoot.JSON.Data.contactFilterRules IDENTITY(JSON.Array)contactFilterRules;
SET OutputRoot.JSON.Data.contactFilterRules.Item[1].contactFieldId = '16';
SET OutputRoot.JSON.Data.contactFilterRules.Item[1].type = 'SYSTEM_ARRAY';
SET OutputRoot.JSON.Data.contactFilterRules.Item[1].operator = 'IN';
SET OutputRoot.JSON.Data.contactFilterRules.Item[1].dataType = 'NUMBER';
SET OutputRoot.JSON.Data.contactFilterRules.Item[1].columnName = 'groups';
SET OutputRoot.JSON.Data.contactFilterRules.Item[1].contactFilterOption = 'IN';
How to write logic for Column Value..? Please help.
Thanks,
Soudhanya |
|
Back to top |
|
 |
timber |
Posted: Tue Oct 02, 2018 6:30 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
There's a standard approach for this sort of thing:
1. Create the JSON message that you want IIB to write
2. Add a Trace node to your message flow. Set the Pattern property to ${Root}
3. Parse the JSON message
4. Inspect the Trace node output
5. Modify your ESQL until the message tree that you send to the output node looks exactly like the message tree produced by the JSON parser |
|
Back to top |
|
 |
knandipati |
Posted: Wed Jun 19, 2019 2:45 pm Post subject: |
|
|
Newbie
Joined: 28 May 2019 Posts: 2
|
timber wrote: |
There's a standard approach for this sort of thing:
1. Create the JSON message that you want IIB to write
2. Add a Trace node to your message flow. Set the Pattern property to ${Root}
3. Parse the JSON message
4. Inspect the Trace node output
5. Modify your ESQL until the message tree that you send to the output node looks exactly like the message tree produced by the JSON parser |
Give this guy a medal.This worked.
I was trying to write a SELECT on JSON and then i realized the syntax is different from XML to JSON.You have to append 'Item' word after any array.
Example: SELECT I from InputRoot.JSON.Data.Files.Item[] AS I |
|
Back to top |
|
 |
rekarm01 |
Posted: Wed Jun 19, 2019 7:18 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
knandipati wrote: |
Give this guy a medal. This worked. |
He's a smart guy. IBM should offer him a job. And a raise.
Another approach, though not as standard, is to consult the documentation, and then search for any relevant information, such as this, or this, or this. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jun 20, 2019 4:58 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
rekarm01 wrote: |
He's a smart guy. |
rekarm01 wrote: |
IBM should offer him a job. |
Or his IBM job back? @timber, did you get culled?
rekarm01 wrote: |
And a raise. |
Goes without saying. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|