Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Any way to parse JSON? #4098

ozonshak ·

Hello. I was wondering if groovy provides any support for parsing JSON in Quickbuild? I see that Groovy supports this in general, but I can't seem to find a package that works from within Quickbuild. I have a need for this and was hoping to code this within Quickbuild. Thanks.

  • replies 1
  • views 1986
  • stars 0
robinshen ADMIN ·

The JsonSlurper can be used. For instance:

groovy:
def jsonSlurper = new groovy.json.JsonSlurper()
def object = jsonSlurper.parseText('{ "name": "John Doe" } /* some comment */')

assert object instanceof Map
assert object.name == 'John Doe'