Package com.google.gson
Class JsonParser
- java.lang.Object
-
- com.google.gson.JsonParser
-
public final class JsonParser extends java.lang.ObjectA parser to parse Json into a parse tree ofJsonElements- Since:
- 1.3
-
-
Constructor Summary
Constructors Constructor Description JsonParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonElementparse(JsonReader json)Returns the next value from the JSON stream as a parse tree.JsonElementparse(java.io.Reader json)Parses the specified JSON string into a parse treeJsonElementparse(java.lang.String json)Parses the specified JSON string into a parse tree
-
-
-
Method Detail
-
parse
public JsonElement parse(java.lang.String json) throws JsonSyntaxException
Parses the specified JSON string into a parse tree- Parameters:
json- JSON text- Returns:
- a parse tree of
JsonElements corresponding to the specified JSON - Throws:
JsonParseException- if the specified text is not valid JSONJsonSyntaxException- Since:
- 1.3
-
parse
public JsonElement parse(java.io.Reader json) throws JsonIOException, JsonSyntaxException
Parses the specified JSON string into a parse tree- Parameters:
json- JSON text- Returns:
- a parse tree of
JsonElements corresponding to the specified JSON - Throws:
JsonParseException- if the specified text is not valid JSONJsonIOExceptionJsonSyntaxException- Since:
- 1.3
-
parse
public JsonElement parse(JsonReader json) throws JsonIOException, JsonSyntaxException
Returns the next value from the JSON stream as a parse tree.- Throws:
JsonParseException- if there is an IOException or if the specified text is not valid JSONJsonIOExceptionJsonSyntaxException- Since:
- 1.6
-
-