public final class

JsonParser

extends Object
java.lang.Object
   ↳ com.google.gson.JsonParser

Class Overview

A parser to parse Json into a parse tree of JsonElements

Summary

Public Constructors
JsonParser()
Public Methods
JsonElement parse(JsonReader json)
Returns the next value from the JSON stream as a parse tree.
JsonElement parse(Reader json)
Parses the specified JSON string into a parse tree
JsonElement parse(String json)
Parses the specified JSON string into a parse tree
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public JsonParser ()

Public Methods

public JsonElement parse (JsonReader json)

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 JSON
JsonIOException
JsonSyntaxException

public JsonElement parse (Reader json)

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 JSON
JsonIOException
JsonSyntaxException

public JsonElement parse (String json)

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 JSON
JsonSyntaxException