- java.lang.Object
-
- com.google.gson.JsonParser
-
public final class JsonParser extends Object
A parser to parse Json into a parse tree ofJsonElements- Since:
- 1.3
- Author:
- Inderjeet Singh, Joel Leitch
-
-
Constructor Summary
Constructors Constructor Description JsonParser()Deprecated.No need to instantiate this class, use the static methods instead.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description JsonElementparse(JsonReader json)Deprecated.JsonElementparse(Reader json)Deprecated.JsonElementparse(String json)Deprecated.static JsonElementparseReader(JsonReader reader)Returns the next value from the JSON stream as a parse tree.static JsonElementparseReader(Reader reader)Parses the specified JSON string into a parse treestatic JsonElementparseString(String json)Parses the specified JSON string into a parse tree
-
-
-
Constructor Detail
-
JsonParser
@Deprecated public JsonParser()
Deprecated.No need to instantiate this class, use the static methods instead.
-
-
Method Detail
-
parseString
public static JsonElement parseString(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
-
parseReader
public static JsonElement parseReader(Reader reader) throws JsonIOException, JsonSyntaxException
Parses the specified JSON string into a parse tree- Parameters:
reader- JSON text- Returns:
- a parse tree of
JsonElements corresponding to the specified JSON - Throws:
JsonParseException- if the specified text is not valid JSONJsonIOExceptionJsonSyntaxException
-
parseReader
public static JsonElement parseReader(JsonReader reader) 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
-
parse
@Deprecated public JsonElement parse(String json) throws JsonSyntaxException
Deprecated.- Throws:
JsonSyntaxException
-
parse
@Deprecated public JsonElement parse(Reader json) throws JsonIOException, JsonSyntaxException
Deprecated.- Throws:
JsonIOExceptionJsonSyntaxException
-
parse
@Deprecated public JsonElement parse(JsonReader json) throws JsonIOException, JsonSyntaxException
Deprecated.- Throws:
JsonIOExceptionJsonSyntaxException
-
-