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 » JSON parser adding special character

Post new topic  Reply to topic
 JSON parser adding special character « View previous topic :: View next topic » 
Author Message
Partha.Baidya
PostPosted: Tue Jun 02, 2020 5:29 pm    Post subject: JSON parser adding special character Reply with quote

Voyager

Joined: 05 Nov 2009
Posts: 97

I have a flow where I get JOSN data from a HTTP Input node. I store the JSON data in Environment variable.
Code:
CREATE LASTCHILD OF Environment DOMAIN ('JSON') FROM InputRoot.JSON;


Later in the code I create a output from the environment variable and put to a file as well to a MQ Queue.
Code:
SET OutputRoot.JSON = Environment.JSON;


The JSON data has a date field as String.
Code:
"startDate": "06/01/2020"


The file gets created with proper JSON data but the MQ message has extra special character for the date field.
Code:
startDate="06\/01\/2020"


I am not getting the reason why the MQ message get special characters around the "/".

Any suggestion.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jun 02, 2020 7:28 pm    Post subject: Re: JSON parser adding special character Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Partha.Baidya wrote:
I have a flow where I get JOSN data from a HTTP Input node. I store the JSON data in Environment variable.
Code:
CREATE LASTCHILD OF Environment DOMAIN ('JSON') FROM InputRoot.JSON;


Later in the code I create a output from the environment variable and put to a file as well to a MQ Queue.
Code:
SET OutputRoot.JSON = Environment.JSON;


The JSON data has a date field as String.
Code:
"startDate": "06/01/2020"


The file gets created with proper JSON data but the MQ message has extra special character for the date field.
Code:
startDate="06\/01\/2020"


I am not getting the reason why the MQ message get special characters around the "/".

Any suggestion.

Are you seeing that extra char when you retrieve the message? Looks to me it is an escape char because otherwise the '/' would have a different meaning??
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
martinb
PostPosted: Thu Jun 04, 2020 3:43 am    Post subject: Reply with quote

Master

Joined: 09 Nov 2006
Posts: 210
Location: UK

The JSON specification, JSON.org states that forward slash, "solidus" can be escaped.

By default the IIB/ACE JSON serializer does escape forward slash, hence it is expected that your '/' become '\/' in the JSON output.

However IIB/ACE does provide a JSON configuration parameter "escapeMode" which can be set to change this behavior. Please see Parameter values for the JSON parser
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 » JSON parser adding special character
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.