Hi Guys,
I want to create a dynamic json array in groovy script for rest payload.
I am able to take the input array but unable to create the json from it, please help.
def inpuArray = execution.getVariables();
println inpuArray;
def jsonData= []
inpuArray.each { key, value->
println “${key} has the ${value}”
jsonData.add(${key});
};
println jsonData;
output:
Cannot instantiate process definition holiday:1:fb7e1b33-d728-11e9-8996-1062e5902aa5: Unable to evaluate script while executing activity ‘ServiceTask_1’ in the process definition with id ‘holiday:1:fb7e1b33-d728-11e9-8996-1062e5902aa5’: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.$() is applicable for argument types: (Script4$_run_closure1$_closure2) values: [Script4$_run_closure1$_closure2@1522d4df] Possible solutions: is(java.lang.Object), any(), get(java.lang.String), use([Ljava.lang.Object;), any(groovy.lang.Closure), wait()