Hello,
i have a Web Service and i save the Result.body response as in a process variable map.
For auditing reasons i need to save this result as a *.json file that just needs to stay in the Knowledge Center for now.
How can i achieve this?
I have tried using a template but from Map to document i loose all the Json elements.
Thank you
Discussion posts and replies are publicly visible
The smart service "Test from Template" can write any text to a file. Create a template.json file with the content "###json###" and write to it whatever you need.
Unknown said:"Test from Template"
For the sake of confusion reduction, that is of course the "Text Doc from Template" node.
Sadly there isn't (yet?) a rule-based approach (like we have with, say, a!exportDataStoreEntityToExcel()), but the process-based node works well enough at least.
Thank you and Mike Schmitt . I mentioned I had altready tried using "Text Doc from Template" but maybe I wasn't clear, let me show you what I've tried to do:
I've configured a Test Process Model where I save the web service response as a Map and as a Text:
then try to write both in the above template:
These are the two resulting files, they are not valid json:
Am I missing something?
Thank you for your time
try tojson(pv!bodyMap) for BODY parameter.
yeah, if you pass a MAP directly into the "body" replacement, i'm not sure why you'd expect it to output as JSON - a MAP is not JSON. As Abhay suggested, you can wrap the map value in a!toJson and get a proper JSON string for output into your document.
Well you are right, it was a misjudgment on my part thinking the map would be written out as i saw it in the process variable.
Thank you all