I am trying to display json file content as multiselect within Choice Active Parameter.
This is my code:
//import groovy.json.JsonSlurperClassic
import groovy.json.JsonSlurper
//def parseJsonText(String jsonText) {
// final slurper = new JsonSlurperClassic()
// return slurper.parseText(jsonText)
// }
node('master') {
// def fichero = readFile('/var/jenkins_home/workspace/free/dos.json')
// configuracion = parseJsonText(fichero)
// println configuracion
def jsonSlurper = new JsonSlurper()
def object = jsonSlurper.parseText('{ "server": "axn","server2":"azn" }')
println object
}
I have tried JsonSlurper and JsonSlurperClassic libraries.
If the parsing of my json is in text inside the script it works fine, but if I retrieve the json content from a file it doesn't work.
Both codes are tested as pipelines and return the same result.