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 SupportXML to JSON conversion - Empty field

Post new topicReply to topic
XML to JSON conversion - Empty field View previous topic :: View next topic
Author Message
ghoshly
PostPosted: Fri Mar 01, 2019 5:17 pm Post subject: XML to JSON conversion - Empty field Reply with quote

Master

Joined: 10 Jan 2008
Posts: 280

Hello,

I am using IIB v10.0.0.10 and converting an XML input to JSON format to call external service. In case of an empty field (<EndDate></EndDate>), by default JSON serializer is creating an empty object with {} notation as "EndDate":{}. However, the end system is failing to understand / accept the format and expecting "" in place.

Is there a way / configuration in IIB, that I can use to generate empty JSON field as "EndDate": ""

Thanks in advance.
Back to top
View user's profile Send private message
timber
PostPosted: Mon Mar 04, 2019 2:31 am Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1017

There is no way to do this in the JSON output.
However, you may be able to add a default value to your XML Schema for EndDate, so that an empty string gets parsed as "EndDate". Just bear in mind that "EndDate" is not a valid XML Schema date, so you will need to model it as xs:string.
Back to top
View user's profile Send private message
ghoshly
PostPosted: Mon Mar 04, 2019 7:28 am Post subject: XML to JSON conversion - Empty field Reply with quote

Master

Joined: 10 Jan 2008
Posts: 280

Thanks Kimbert for your reply. Source side application is not a problem here and the issue is with Target system which is expecting "" only to perform certain tasks.
Back to top
View user's profile Send private message
timber
PostPosted: Mon Mar 04, 2019 9:29 am Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1017

Quote:
Source side application is not a problem here and the issue is with Target system
Yes, I got that. But your message flow must be parsing the XML, so it can apply default values while doing so. You should be able to automatically convert an empty EndDate tag into a tag with a default value.
Back to top
View user's profile Send private message
ghoshly
PostPosted: Thu Mar 07, 2019 1:20 pm Post subject: Handling with NULL value. Reply with quote

Master

Joined: 10 Jan 2008
Posts: 280

Luckily, the end system accepted NULL VALUE for the field and I am handling it that way.
Back to top
View user's profile Send private message
akashnambiar95
PostPosted: Thu Mar 07, 2019 10:34 pm Post subject: Reply with quote

Newbie

Joined: 07 Mar 2019
Posts: 1

Did you try using the coalesce function? I think that'd help
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 SupportXML to JSON conversion - Empty field
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.