ScriptRunner Cloud JSON parsing and formatting

Since import statement is not working in Cloud ScriptRunner, how do I do JSON parsing and construction?

Unirest has some JSON-related classes like JsonNode (you can parse valid JSON with this one), but other classes like JSONObject and JSONArray, you can only get one from a method call but not instantiate one.

image

If I want to programmatically construct a JSON body to send to Unirest’s .body() method, how do I go about that?

1 Like