After parsing JSON with JsonSlurper you get a Map . If FizzBuzz has a Map constructor (see here ), it should work when Map parsing is passed to the constructor.
See the following example:
import groovy.json.JsonSlurper def json = """{ "name": "John", "age": 127 }""" def parsed = new JsonSlurper().parseText(json) def person = parsed as Person assert person.age == 127 assert person.name == 'John' class Person { String name int age }
Opal source share