Posted: Tue Jun 02, 2020 7:28 pm Post subject: Re: JSON parser adding special character
Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 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
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
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