Camunda: How to write json response data in json file?

I want to write my service response data into json file , for this reason i use below code:
var data=S(execution.getVariable(“restResponse”));
var jsonData=JSON.parse(data);
var jsonFile = “embedded:app:forms/file.json”;
var file =fopen(jsonFile,“w”);
file.write(jsonData);
file.close();
but camunda can’t recognize fopen, what should i change to make this process work?

Hi @Sally,

Is this a javascript function?

You could save the data from your response into a process variable. After that, you can write it in a file with Java.

Cheers
kristin

1 Like

@kristin thank you for your reply, it was very helpful