-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
plugin version: 2.8.0
In the Jenkins Script Console, I can't get the readJSON step to work with even a trivial JSON string:
def jstring = '{"one":1, "two":2}'
def jobj = readJSON text: jstring
output:
groovy.lang.MissingMethodException: No signature of method: Script1.readJSON() is applicable for argument types: (java.util.LinkedHashMap) values: [[text: {"one":1, "two":2} ]]
All permutations of the call fail - some with the hashmap error above and others with a simple string type, but it's always the same "no signature" issue.
readJSON jstring, readJSON(jstring), readJSON("${jstring}"), etc
However, in a test pipeline, it works:
pipeline { agent any stages { stage('readjson') { steps { script { def jstring = '{"one":1, "two":2}' def jobj = readJSON text: jstring echo jobj.toString() } } } } }
[Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in C:\Program Files (x86)\Jenkins\workspace\readJSON [Pipeline] { [Pipeline] stage [Pipeline] { (readjson) [Pipeline] script [Pipeline] { [Pipeline] readJSON [Pipeline] echo {"one":1,"two":2} [Pipeline] } [Pipeline] // script [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS