How to pass a Json object to a JavaAction

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
2 answers

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.

Hope this helps.



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.