public class JsonSlurperClassic
extends java.lang.Object
Example usage:
def slurper = new groovy.json.JsonSlurperClassic()
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"
Constructor and Description |
---|
JsonSlurperClassic() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
parse(java.io.File file)
Parse a JSON data structure from content within a given File.
|
java.lang.Object |
parse(java.io.File file,
java.lang.String charset)
Parse a JSON data structure from content within a given File.
|
java.lang.Object |
parse(java.util.Map params,
java.net.URL url)
Parse a JSON data structure from content at a given URL.
|
java.lang.Object |
parse(java.util.Map params,
java.net.URL url,
java.lang.String charset)
Parse a JSON data structure from content at a given URL.
|
java.lang.Object |
parse(java.io.Reader reader)
Parse a JSON data structure from content from a reader
|
java.lang.Object |
parse(java.net.URL url)
Parse a JSON data structure from content at a given URL.
|
java.lang.Object |
parse(java.net.URL url,
java.util.Map params)
Parse a JSON data structure from content at a given URL.
|
java.lang.Object |
parse(java.net.URL url,
java.util.Map params,
java.lang.String charset)
Parse a JSON data structure from content at a given URL.
|
java.lang.Object |
parse(java.net.URL url,
java.lang.String charset)
Parse a JSON data structure from content at a given URL.
|
java.lang.Object |
parseText(java.lang.String text)
Parse a text representation of a JSON data structure
|
public java.lang.Object parseText(java.lang.String text)
text
- JSON text to parsepublic java.lang.Object parse(java.io.Reader reader)
reader
- reader over a JSON contentpublic java.lang.Object parse(java.io.File file)
file
- File containing JSON contentpublic java.lang.Object parse(java.io.File file, java.lang.String charset)
file
- File containing JSON contentcharset
- the charset for this Filepublic java.lang.Object parse(java.net.URL url)
url
- URL containing JSON contentpublic java.lang.Object parse(java.net.URL url, java.util.Map params)
url
- URL containing JSON contentparams
- connection parameterspublic java.lang.Object parse(java.util.Map params, java.net.URL url)
params
- connection parametersurl
- URL containing JSON contentpublic java.lang.Object parse(java.net.URL url, java.lang.String charset)
url
- URL containing JSON contentcharset
- the charset for this Filepublic java.lang.Object parse(java.net.URL url, java.util.Map params, java.lang.String charset)
url
- URL containing JSON contentparams
- connection parameterscharset
- the charset for this Filepublic java.lang.Object parse(java.util.Map params, java.net.URL url, java.lang.String charset)
params
- connection parametersurl
- URL containing JSON contentcharset
- the charset for this File