|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.commons.util.io.json.JsonParser
public class JsonParser
JSON parser.
This class provides some methods for generating parsing JSON text and create objects out of it. It uses a factory to deal with the actual object classes.
Nested Class Summary | |
---|---|
static interface |
JsonParser.ParseCallback
Callback when a stream of json entries is parsed |
Constructor Summary | |
---|---|
JsonParser()
|
Method Summary | |
---|---|
static java.lang.Object |
fromJson(JsonFactory factory,
java.io.Reader reader)
Parse a JSON stream and return an object. |
static void |
fromJson(JsonFactory factory,
java.io.Reader reader,
JsonParser.ParseCallback cb)
Parse a JSON stream and call a function for each entry. |
static void |
fromJson(JsonFactory factory,
java.io.Reader reader,
java.util.List<java.lang.Object> list)
Parse a JSON stream and add all the entries to a list. |
static java.lang.Object |
fromJson(JsonFactory factory,
java.lang.String json)
Parse a JSON text and return an object. |
static boolean |
isJson(java.lang.String json)
Check if a string a a valid JSON text. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JsonParser()
Method Detail |
---|
public static boolean isJson(java.lang.String json)
json
- the JSON text to check
JsonException
public static java.lang.Object fromJson(JsonFactory factory, java.lang.String json) throws JsonException
factory
- the object factoryjson
- the JSON text
JsonException
public static java.lang.Object fromJson(JsonFactory factory, java.io.Reader reader) throws JsonException
factory
- the object factoryreader
- the JSON stream
JsonException
public static void fromJson(JsonFactory factory, java.io.Reader reader, java.util.List<java.lang.Object> list) throws JsonException
factory
- the object factoryreader
- the JSON streamcb
- the cllback to call for each entry
JsonException
public static void fromJson(JsonFactory factory, java.io.Reader reader, JsonParser.ParseCallback cb) throws JsonException
factory
- the object factoryreader
- the JSON streamcb
- the cllback to call for each entry
JsonException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |