fun <http://java.io|java.io>.InputStream.extractSummary(): String =
((JsonSlurper().parse(this) as Map<String, Any>)["fields"] as Map<String, Any>)["summary"] as String
I looked around a lot, couldn't find a way to make this code block simpler. Would like to do something similar to Groovy, which allows me to call just
this.fields.summary
.
Any ideas?
r
ribesg
03/03/2020, 3:09 PM
That’s because Groovy isn’t really typed. Try to parse your InputStream as an actual model instead of just a map
t
Thiago Nerys
03/03/2020, 3:11 PM
JsonSlurper won't give me that option and I don't want to add a library to do that