First off, user questions should be sent to users@groovy.apache.org not
d...@groovy.apache.org, as the later is for the dev team to discuss the ins
and outs of Groovy, I have added users@groovy.apache.org to continue the
conversation there

Second, I just tried your code in Groovy Console on Groovy 4.0.1/Java 8 and
it worked, so you need to provide more information about what version of
Groovy and Java you are using.

Bonus, this:
def req = new URL("https://jsonplaceholder.typicode.com/todos/1
").openConnection();
def postRC = req.getResponseCode();
def streamText = req.getInputStream().getText()

can be replaced with:
def streamText = 'https://jsonplaceholder.typicode.com/todos/1'.toURL().text



Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry
Mobile: +45 40 44 91 88
--- Press ESC once to quit - twice to save the changes.


Den tir. 5. jul. 2022 kl. 12.49 skrev Dharma Teja <dharma.t...@appfire.com>:

> Hi Team,
>
> When I was using the below groovy script, *groovy.json.JsonSulper *was
> throwing this error, Can you please help me with this
>
> Throws java.lang.RuntimeException: Unable to load FastStringService
>
>
> import groovy.json.*
> import java.net.http.*
> def req = new URL("https://jsonplaceholder.typicode.com/todos/1
> ").openConnection();
> def postRC = req.getResponseCode();
> def streamText = req.getInputStream().getText()
> def jsonSlurper = new JsonSlurper()
> println streamText
> def json = jsonSlurper.parseText(streamText)
> println json
>
>
> Thanks,
> Teja
>

Reply via email to