Jenkins: Fetching the value of a JSON Extended Choice Parameter

5.8k Views Asked by At

I'm trying to use Extended Choice Parameter in my jenkins project - with the JSON option.

I've built a very nice JSON parameter "DestinationEnvironment", and I'm trying to get one of the its properties "DestinationServer" for the build step, but I'm not sure how I access the inner properties of it.

Will appreciate any help!

2

There are 2 best solutions below

0
On

The JSON Parameter feature for the Extended Choice Parameter is based on the https://github.com/jdorn/json-editor

So the groovy script should return a JSON object that corresponds to the "options" object referred to in json-editor

This can be parsed in a groovy script: http://groovy-lang.org/json.html

0
On

{"DestinationEnvironment": "DestinationServer"}

Try this..