How to pass a Json object to a JavaAction

1
Hi everyone, I am just testing out a few things. The idea is to use this function. public static ByteArrayInputStream generateDocument(String templatePath, JSONObject fields){ And for that I need to pass Json Object. The question I have is, what should be the input parameter for the JavaAction? Thanks
asked
2 answers
1

Following the update, I would suggest passing the JSON as a String into your Java Action. You would then need to use a StringReader and the readObject method to turn it into a JSONObject as this isn’t a Mendix class.

https://docs.oracle.com/javaee/7/api/javax/json/JsonReader.html

Hope this helps.

 

answered
0

Either use an export mapping to create a JSON string that you can pass to the Java action and then create a JSON object again from that string or just pass a root object to the Java and then in Java retrieve all the attached objects over the references to that root object.

Regards,

Ronald

 

answered