Package com.google.gwt.json.client
Class JSONParser
java.lang.Object
com.google.gwt.json.client.JSONParser
Parses the string representation of a JSON object into a set of
JSONValue-derived objects.
- See Also:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic JSONValue
Deprecated.static JSONValue
parseLenient
(String jsonString) Deprecated.static JSONValue
parseStrict
(String jsonString) Evaluates a JSON string and returns its JSONValue representation.(package private) static void
throwJSONException
(String message) (package private) static void
throwUnknownTypeException
(String typeString)
-
Field Details
-
typeMap
-
-
Method Details
-
parse
Deprecated.Evaluates a trusted JSON string and returns its JSONValue representation. CAUTION! This method calls the JavaScripteval()
function, which can execute arbitrary script. DO NOT pass an untrusted string into this method.This method has been deprecated. Please call either
parseStrict(String)
(for inputs that strictly follow the JSON specification) orparseLenient(String)
. The implementation of this method calls parseLenient.- Parameters:
jsonString
- a JSON object to parse- Returns:
- a JSONValue that has been built by parsing the JSON string
- Throws:
NullPointerException
- ifjsonString
isnull
IllegalArgumentException
- ifjsonString
is empty
-
parseLenient
Deprecated.Evaluates a trusted JSON string and returns its JSONValue representation. CAUTION! This method calls the JavaScripteval()
function, which can execute arbitrary script. DO NOT pass an untrusted string into this method.- Parameters:
jsonString
- a JSON object to parse- Returns:
- a JSONValue that has been built by parsing the JSON string
- Throws:
NullPointerException
- ifjsonString
isnull
IllegalArgumentException
- ifjsonString
is empty
-
parseStrict
Evaluates a JSON string and returns its JSONValue representation. The browser'sJSON.parse function
is used.- Parameters:
jsonString
- a JSON object to parse- Returns:
- a JSONValue that has been built by parsing the JSON string
- Throws:
NullPointerException
- ifjsonString
isnull
IllegalArgumentException
- ifjsonString
is empty
-
throwJSONException
-
throwUnknownTypeException
-
parseStrict(String)