goog.json
Functions
isValid( s ) → boolean
boolean
parse( s ) → (Object|null)
(Object|null)
Parses a JSON string and returns the result. This throws an exception if the string is an invalid JSON string.
Note that this is very slow on large strings. Use JSON.parse if possible.
warning Deprecated | Use JSON.parse. |
---|
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
| ||||
Throws |
|
serialize( object, opt_replacer ) → string
string
Serializes an object or a value to a JSON string.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
| ||||||||
Throws |
|
setErrorLogger( errorLogger ) → void
void
Properties
JSON replacer, as defined in Section 15.12.3 of the ES5 spec.
See Also |
---|
JSON reviver, as defined in Section 15.12.2 of the ES5 spec.
See Also |
---|
Compiler Constants
goog.json.USE_NATIVE_JSON → boolean
boolean
If true, use the native JSON parsing API.
NOTE: The default goog.json.parse
implementation is able to handle
invalid JSON. JSPB used to produce invalid JSON which is not the case
anymore so this is safe to enable for parsing JSPB. Using native JSON is
faster and safer than the default implementation using eval
.