I was previously using the groovy class JsonSlurper to edit a json before sending it to REST web services
seems that the class is no more supported
what is the workaround to do the same thing
- create a json object using template string
- modifying the json structure
- sending the json string to web service
Solved! Go to Solution.
As far as I can tell JsonSlurper is still supported by groovy
Could you give any more information on your issue?
Hi, thanks for your help
my groovy code is very simple
def slurper = new JsonSlurper()
def object = slurper.parseText(jsonAsText)
object.name = context.servername1
I receive now an error
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script14.groovy: 36: unable to resolve class JsonSlurper @ line 36, column 15. def slurper = new JsonSlurper() ^ org.codehaus.groovy.syntax.SyntaxException: unable to resolve class JsonSlurper @ line 36, column 15. at
I saw in a post a ne class jsonUtils introduced in 2.4, I can parse json but not modify it
Do you have an idea ?