ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexWebSphere Message Broker SupportJSON Nested Arrays in ESQL

Post new topicReply to topic
JSON Nested Arrays in ESQL View previous topic :: View next topic
Author Message
soudhanya
PostPosted: Mon Oct 01, 2018 6:02 am Post subject: JSON Nested Arrays in ESQL Reply with quote

Novice

Joined: 27 Feb 2017
Posts: 17

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
View user's profile Send private message Send e-mail
timber
PostPosted: Tue Oct 02, 2018 6:30 am Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1002

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
View user's profile Send private message
knandipati
PostPosted: Wed Jun 19, 2019 2:45 pm Post subject: Reply with quote

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
View user's profile Send private message
rekarm01
PostPosted: Wed Jun 19, 2019 7:18 pm Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1365

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
View user's profile Send private message
Vitor
PostPosted: Thu Jun 20, 2019 4:58 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25732
Location: Ohio, 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
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportJSON Nested Arrays in ESQL
Jump to:



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
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.