I would suggest a javascript action call.
You set the required object (mxObj) as parameter, and set the return value as string.
Then in the code you process the object and convert the result into a string.
/**
* @param {MxObject} mxObj
* @returns {Promise.<string>}
*/
export async function JavaScript_action_CreateJson(mxObj) {
// BEGIN USER CODE
// create the result object
var result = {};
// dynamicly read all attirbutes and set the attibute name and value to our result object
mxObj.getAttributes()
.forEach(function(attributeName) {
result[attributeName] = mxObj.get(attributeName);
});
// convert our result to a string and return it
return JSON.stringify(result);
// END USER CODE
Then in your, calling nanoflow you get this
In my example i set the returned json string as an attribute of my entity, but offcourse you can use it right away to send it over an API call.
I am not sure if this is the best way to do so, but at least it will do what you want it to do.
Succeeded today in exporting a list of objects to a JSON-string by upgrading to Mx 8.8.1, having a nanoflow call a microflow and have that microflow call an Export-to-JSON activity for a non-persistent entity. So I will be upgrading our app and avoid creating our own javascript-export-to-JSON widget.