Skip to content
ghdrako edited this page Oct 27, 2023 · 3 revisions

each - problem

https://stackoverflow.com/questions/3049790/can-you-break-from-a-groovy-each-closure

JSON

  1. JsonSlurperJsonSlurper is a class that parses JSON text or reader content into Groovy dataStructures such as maps, lists and primitive types like Integer, Double, Boolean and String.
  2. JsonOutputThis method is responsible for serialising Groovy objects into JSON strings.
new JsonSlurper().parseText(response.content)

JSON slurper parses text or reader content into a data structure of lists and maps.

def jsonSlurper = new JsonSlurper()
      Object lst = jsonSlurper.parseText('{ "List": [2, 3, 4, 5] }')
      lst.each { println it }

Test

Clone this wiki locally