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 Index » WebSphere Message Broker (ACE) Support » Double quotes separated with Commas for a string

Post new topic  Reply to topic
 Double quotes separated with Commas for a string « View previous topic :: View next topic » 
Author Message
nick405
PostPosted: Tue Jun 22, 2021 3:28 pm    Post subject: Double quotes separated with Commas for a string Reply with quote

Newbie

Joined: 19 May 2014
Posts: 4

I am building a JSON request to call an internal REST webservice. The Request was built perfectly but missing closed double quote for every number before the comma seperated.

For example -- I am able to send to REST service as

"accountNumbers":["57575757,11005647"]

But the required Out put is

"accountNumbers":["57575757","11005647"]

Logic Used -- SET OutputRoot.JSON.Data.(JSON.Array)accountRestrictionTransactions.Item[1].(JSON.Array)accountNumbers.Item[1] = Environment.Variables.acctNumbersList ;


This particular Environment.Variables.acctNumbersList will have the below
acctNumbersList:CHARACTER:57575757,11005647

Can you help with this double quote per number in this string as I tried || and other options to break it down which did not work
Back to top
View user's profile Send private message
timber
PostPosted: Tue Jun 29, 2021 11:34 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Your ESQL is creating a JSON array with one value : "57575757,11005647"

You need to create a JSON array with two values, like this (not tested):
Code:
CREATE refArray REFERENCE TO OutputRoot.JSON.Data.(JSON.Array)accountRestrictionTransactions;
CREATE LASTCHILD OF refArray TYPE NameValue Name 'Item' Value '57575757';
CREATE LASTCHILD OF refArray TYPE NameValue Name 'Item' Value '11005647';
You could do the same thing with Item[1], Item[2] but the CREATE LASTCHILD technique is easier to extend - especially if you use a FOR loop.

But hopefully, Environment.Variables.acctNumbersList is an array and not a CHARACTER variable containing commas. So it would be easier to do this
Code:
SET OutputRoot.JSON.Data.(JSON.Array)accountRestrictionTransactions.Item[] =
    SELECT
        accNum AS Item
    FROM
        Environment.Variables.acctNumbersList AS accNum;
Again, this is not tested code and probably does not work as-is. But hopefully it's enough to put you on the right track.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Double quotes separated with Commas for a string
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.