Sometime is tricky testing such responses, I’ve been hit by this. Some API’s are responding with JSON object, some with JSON array.
If you know wellyour API, the solution is simple, as above … if not …
Groovy is smart enough to handle this himself, avoid strong typing and just do:
parsedJson = slurper.parseText(getContent)
and check the type after
i am using this trick for JSON schema validation, since if it is an object has to use a keyword, if is array must use a different one