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