Groovy web console

subscribe to the feed Subscribe
to this
site

Testing #1

Published 2 weeks ago by supernerd
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import groovy.json.JsonSlurper
JsonSlurper jsonSlurper = new JsonSlurper()

String txt = '''
{
  "KonfigType": "Sanktion",
  "WhitelistOmraader": [
    {
     "Omraade": "Regnskabskontrol",
     "Whitelist": [
       "I001",
      "I002",
      "I300",
      "I301"
     ]
    }
  ],
  "UnixTime": 1619619212
}''' 
Object result1 = jsonSlurper.parseText(txt)
println (result1.keySet())
println (result1.WhitelistOmraader)

println result1.getClass() 
println (result1 instanceof List) 
println (result1 instanceof Map)