
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2022 06:57 AM
Hi,
Relatively new to working with Flow Designer as previously I had hand crafted integrations in script includes but my current customer wants to use IH.
I have a REST call which is receiving a simple JSON message containing the Transaction ID as a response.
{
"Transaction ID":"44081c08-453a-11e6-a9de-d99213c464e0"
}
I have this set up with the JSON Parser step and generated the target:-
No matter what I do, the parser step fails with "JsonParserOperation failed: The transformer returned null as output"
If I remove the space in 'Transaction ID' in the sample payload to make 'TransactionID' and regenerate the target, it works as expected, but this is a software vendor supplied API so I cannot remove this space when working with live systems.
The issue must be related to the space in the Name field on the target structure but I cannot find a way to work around it.
Has anyone encountered this issue and resolved it? Other message structures from the same vendor are more complex, so ideally I want to decide if it is effective to use the JSON parser step at all.
Any help greatly appreciated,
Richard
Solved! Go to Solution.
- Labels:
-
flow designer
-
IntegrationHub

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 07:26 AM
The issue looks to have been the JSON parser step in FD. I removed it and replaced it with a script step and all working fine.
(function execute(inputs, outputs) {
if(!gs.nil(inputs.response_body)){
// Parse the JSON body.
var responseObj = JSON.parse(inputs.response_body);
outputs.transactionid = responseObj["Transaction ID"];
}
})(inputs, outputs);
Thank you for your help.
Richard

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2022 07:06 AM
Hi Richard,
To access the key with spaces (although, ideally, they wouldn't use spaces, just to make things easier) is to use square bracket notation such as:
["Transaction ID"]
So, basically root["Transaction ID"] would work if scripting, etc.
Please mark reply as Helpful/Correct if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2022 08:43 AM
Allen,
Could you give an example of how that would look in the JSON Parser step or are you suggesting I use a script step instead and script the parsing?
Thanks,
Richard

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2022 08:49 AM
Hi,
My apologies for any confusion. I believe with the JSON parser step, it's expecting it to be in the normal, best practice format (no spaces) for keys, to be able to be used.
I'm unsure if you can use the square bracket notation in the "name" field for the parser and may have to use a script step instead (using what I mentioned above).
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2022 08:04 PM
It's probably not a limitation in the JSON parser but Flow Designer because I'm able to parse with the following script.[
var str = '{"Transaction ID": "44081c08-453a-11e6-a9de-d99213c464e0"}';
var json = JSON.parse(str);
gs.info(json["Transaction ID"]);
Try using Script step to retrieve the data and map the result to an output variable name without a space.