Is the file correctly formatted? If you have edited from windows, maybe you 
have wrong line endings

El miércoles, 17 de junio de 2020, 14:38:42 (UTC+2), Antonio Gomez escribió:
>
> Hello,
>
> 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.
>
> Any idea?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/8e65a59a-5be6-4e76-a5d4-b469f38fe77co%40googlegroups.com.

Reply via email to