dburyak

groovy json slurper ordering

May 16th, 2022 (edited)
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.65 KB | None | 0 0
  1. import groovy.json.JsonSlurper
  2.  
  3. println "java   : ${System.properties['java.version']}"
  4. println "groovy : ${GroovySystem.version}"
  5.  
  6. def jsonStr = """
  7. {
  8.    "Id": 533,
  9.    "StartTime": "2022-05-10 11:56:18",
  10.    "EndTime": "2022-05-10 11:58:49",
  11.    "TimeShift": "N/A",
  12.    "Run": "123",
  13.    "Setup": "Test",
  14.    "Version": "3.17",
  15.    "Result": "pass",
  16.    "DebugMode": 1,
  17.    "NumberOfCores": 3,
  18. }
  19. """
  20.  
  21. def json = new JsonSlurper().parseText(jsonStr)
  22. println "json.clas = ${json.getClass()}"
  23.  
  24.  
  25.  
  26. ----------------------------------------------
  27. OUTPUT:
  28.  
  29. java   : 17.0.2
  30. groovy : 3.0.9
  31. json.clas = class org.apache.groovy.json.internal.LazyMap
Add Comment
Please, Sign In to add comment