-
-
Save nom3ad/58b3305410085b7bb4fd0f73c67bced4 to your computer and use it in GitHub Desktop.
How to parse json into a serializable HashMap in Jenkins Groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@NonCPS | |
def parseJson(txt){ | |
def lazyMap = new groovy.json.JsonSlurper().parseText(txt) | |
def map = [:] | |
for ( prop in lazyMap ) { | |
map[prop.key] = prop.value | |
} | |
return map; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment