You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10 lines
7.5 KiB

<!DOCTYPE html><meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>goog.json</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Namespace goog.json</h1><a class="source" href="source/lib/goog/json/json.js.src.html#l21">code &raquo;</a></header><section></section><section><h2>Classes</h2><div class="type-summary"><table><tbody><tr><td><dl><dt><a href="class_goog_json_Serializer.html">goog.json.Serializer</a><dd>Class that is used to serialize JSON objects to a string.</dl></table></div></section><div id="visibility-controls"><b>Show:</b><label for="show-public"><span><input type="checkbox" id="show-public" checked/></span>Public</label><label for="show-protected"><span><input type="checkbox" id="show-protected"/></span>Protected</label><label for="show-private"><span><input type="checkbox" id="show-private"/></span>Private</label></div><section id="typedefs"><h2>Type Definitions</h2><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/json/json.js.src.html#l133">code &raquo;</a><a class="member" name="goog.json.Replacer">goog.json.Replacer</a> : <code class="type">function(this: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>, *): *</code></div><div>JSON replacer, as defined in Section 15.12.3 of the ES5 spec.</div></summary></details></div></div><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/json/json.js.src.html#l142">code &raquo;</a><a class="member" name="goog.json.Reviver">goog.json.Reviver</a> : <code class="type">function(this: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>, *): *</code></div><div>JSON reviver, as defined in Section 15.12.2 of the ES5 spec.</div></summary></details></div></div></section><section id="static-functions"><h2>Global Functions</h2><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/json/json.js.src.html#l43">code &raquo;</a><span class="member"><a name="goog.json.isValid_">goog.json.isValid_</a> <span class="args">( s )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Tests if a string is an invalid JSON string. This only ensures that we are
not using any invalid characters</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>s: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The string to test.</dl><tr><th>Returns<tr><td><dl>True if the input is a valid JSON string.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/json/json.js.src.html#l96">code &raquo;</a><span class="member"><a name="goog.json.parse">goog.json.parse</a> <span class="args">( s )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code></span></div><p>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. If you trust the source of
the string then you should use unsafeParse instead.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>s: <code class="type">*</code><dd>The JSON string to parse.</dl><tr><th>Returns<tr><td><dl>The object generated from the JSON string, or null.</dl><tr><th>Throws<tr><td><dl><dt><dd>if s is invalid JSON.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/json/json.js.src.html#l156">code &raquo;</a><span class="member"><a name="goog.json.serialize">goog.json.serialize</a> <span class="args">( object, opt_replacer )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Serializes an object or a value to a JSON string.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>object: <code class="type">*</code><dd>The object to serialize.<dt>opt_replacer: <code class="type">?<a href="namespace_goog_json.html#goog.json.Replacer">goog.json.Replacer</a>=</code><dd>A replacer function
called for each (key, value) pair that determines how the value
should be serialized. By defult, this just returns the value
and allows default serialization to kick in.</dl><tr><th>Returns<tr><td><dl>A JSON string representation of the input.</dl><tr><th>Throws<tr><td><dl><dt><dd>if there are loops in the object graph.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/json/json.js.src.html#l118">code &raquo;</a><span class="member"><a name="goog.json.unsafeParse">goog.json.unsafeParse</a> <span class="args">( s )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code></span></div><p>Parses a JSON string and returns the result. This uses eval so it is open
to security issues and it should only be used if you trust the source.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>s: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The JSON string to parse.</dl><tr><th>Returns<tr><td><dl>The object generated from the JSON string.</dl></table></div></details></div></div></section><section id="compiler-constants"><h2>Compiler Constants</h2><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/json/json.js.src.html#l33">code &raquo;</a><span class="member"><a name="goog.json.USE_NATIVE_JSON">goog.json.USE_NATIVE_JSON</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div></summary></details></div></div></section></main><nav id="topnav"><div><div id="menubutton"><label for="sidenav-toggle">Menu</label></div><form id="searchbox"><div><input type="search" placeholder="Search" tabindex="1"></div></form></div></nav><nav id="sidenav"><input type="checkbox" id="sidenav-types-ctrl" /><input type="checkbox" id="sidenav-files-ctrl" /><input type="checkbox" id="sidenav-modules-ctrl" /><a id="sidenav-overview"><div><h4>Overview</h4></div></a><div id="sidenav-types"><label for="sidenav-types-ctrl"><h4>Types</h4></label><i>No data</i></div><div id="sidenav-modules"><label for="sidenav-modules-ctrl"><h4>Modules</h4></label><i>No data</i></div><div id="sidenav-files"><label for="sidenav-files-ctrl"><h4>Files</h4></label><i>No data</i></div><a href="license.html"><div><h4>License</h4></div></a></nav><div id="push-footer"></div></div><footer><a href="https://github.com/jleyba/js-dossier">Generated by dossier</a></footer><script src="types.js"></script><script src="dossier.js"></script>