Questions tagged [jsonslurper]

JsonSlurper is a Groovy class that makes parsing and working with JSON simpler than with Java.

JSON slurper which parses text or reader content into a data structure of lists and maps.

Example usage:

 def slurper = new JsonSlurper()
 def result = slurper.parseText('{"person":{"name":"Guillaume","age":33,"pets":["dog","cat"]}}')

 assert result.person.name == "Guillaume"
 assert result.person.age == 33
 assert result.person.pets.size() == 2
 assert result.person.pets[0] == "dog"
 assert result.person.pets[1] == "cat"

For more info see the docs.

123 questions
-2
votes
3 answers

Pull key from json file when values is known (groovy or python)

Is there any way to pull the key from JSON if the only thing I know is the value? (In groovy or python) An example: I know the "_number" value and I need a key. So let's say, known _number is 2 and as an output, I should get dsf34f43f34f34f { …
user5634387
-2
votes
1 answer

Using JsonSlurper to parse MySQL Json output returns groovy.lang.MissingMethodException

I am currently working on a way to parse the output of a section of a MySQL query using Groovy's JsonSlurper. I am trying to pull the LAT and LONG values from this query. The query with the Json included reads fine into the database, with the…
AD26891
  • 73
  • 2
  • 11
1 2 3
8
9