Package com.google.gson
Class JsonParser
- java.lang.Object
-
- com.google.gson.JsonParser
-
public final class JsonParser extends java.lang.Object
A parser to parse Json into a parse tree ofJsonElement
s- Since:
- 1.3
-
-
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 JsonElement
parse(JsonReader json)
Deprecated.JsonElement
parse(java.io.Reader json)
Deprecated.JsonElement
parse(java.lang.String json)
Deprecated.static JsonElement
parseReader(JsonReader reader)
Returns the next value from the JSON stream as a parse tree.static JsonElement
parseReader(java.io.Reader reader)
Parses the specified JSON string into a parse treestatic JsonElement
parseString(java.lang.String json)
Parses the specified JSON string into a parse tree
-
-
-
Method Detail
-
parseString
public static JsonElement parseString(java.lang.String json) throws JsonSyntaxException
Parses the specified JSON string into a parse tree- Parameters:
json
- JSON text- Returns:
- a parse tree of
JsonElement
s corresponding to the specified JSON - Throws:
JsonParseException
- if the specified text is not valid JSONJsonSyntaxException
-
parseReader
public static JsonElement parseReader(java.io.Reader reader) throws JsonIOException, JsonSyntaxException
Parses the specified JSON string into a parse tree- Parameters:
reader
- JSON text- Returns:
- a parse tree of
JsonElement
s corresponding to the specified JSON - Throws:
JsonParseException
- if the specified text is not valid JSONJsonIOException
JsonSyntaxException
-
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 JSONJsonIOException
JsonSyntaxException
-
parse
@Deprecated public JsonElement parse(java.lang.String json) throws JsonSyntaxException
Deprecated.- Throws:
JsonSyntaxException
-
parse
@Deprecated public JsonElement parse(java.io.Reader json) throws JsonIOException, JsonSyntaxException
Deprecated.- Throws:
JsonIOException
JsonSyntaxException
-
parse
@Deprecated public JsonElement parse(JsonReader json) throws JsonIOException, JsonSyntaxException
Deprecated.- Throws:
JsonIOException
JsonSyntaxException
-
-