Skip to main content
chiarag0001
Known Participant
Nov 30, 2023 10:21 AM UTC
Solved

Write JSON to document

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

stefanhelzle0001
Brainy
Nov 30, 2023 11:46 AM UTC

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.

6 replies

stefanhelzle0001
Brainy
Nov 30, 2023 11:46 AM UTC

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.

mikes0011
Brainy
Nov 30, 2023 1:13 PM UTC
"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.

The Expression Guru
chiarag0001
Known Participant
Nov 30, 2023 5:13 PM UTC

Thank you [mention:126a676c85024855948336691b0a7b92:e9ed411860ed4f2ba0265705b8793d05] and [mention:b45a4f6a20b14a008e4e0ec732a8bf98:e9ed411860ed4f2ba0265705b8793d05] . 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