~smagoun/whoopsie/whoopsie-lp1017637

« back to all changes in this revision

Viewing changes to backend/stats/static/js/yui/docs/json/index.html

  • Committer: Evan Dandrea
  • Date: 2012-05-09 05:53:45 UTC
  • Revision ID: evan.dandrea@canonical.com-20120509055345-z2j41tmcbf4as5uf
The backend now lives in lp:daisy and the website (errors.ubuntu.com) now lives in lp:errors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html>
2
 
<html lang="en">
3
 
<head>
4
 
    <meta charset="utf-8">
5
 
    <title>JSON</title>
6
 
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Maven+Pro:400,700">
7
 
    <link rel="stylesheet" href="../../build/cssgrids/grids-min.css">
8
 
    <link rel="stylesheet" href="../assets/css/main.css">
9
 
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
10
 
    <script src="../../build/yui/yui-min.js"></script>
11
 
</head>
12
 
<body>
13
 
 
14
 
<div id="doc">
15
 
    <h1>JSON</h1>
16
 
 
17
 
    
18
 
        <a href="#toc" class="jump">Jump to Table of Contents</a>
19
 
    
20
 
 
21
 
    <div class="yui3-g">
22
 
        <div class="yui3-u-3-4">
23
 
            <div id="main">
24
 
                <div class="content"><div class="intro component">
25
 
    <p>
26
 
        The JSON module is an implementation of the ECMA 5 specification for
27
 
        transforming data to and from <a
28
 
        href="http://en.wikipedia.org/wiki/JSON">JavaScript Object
29
 
        Notation</a>.  JSON is a safe, efficient, and reliable data interchange
30
 
        format.  This module provides a JavaScript implementation of the spec,
31
 
        based on <a
32
 
        href="https://github.com/douglascrockford/JSON-js/blob/master/json2.js">Douglas
33
 
        Crockford's json2.js</a>.  For browsers with native support it defers
34
 
        to the native implementation.
35
 
    </p>
36
 
</div>
37
 
                
38
 
<h2 id="getting-started">Getting Started</h2>
39
 
 
40
 
<p>
41
 
To include the source files for JSON and its dependencies, first load
42
 
the YUI seed file if you haven't already loaded it.
43
 
</p>
44
 
 
45
 
<pre class="code prettyprint">&lt;script src=&quot;http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.5.0&#x2F;build&#x2F;yui&#x2F;yui-min.js&quot;&gt;&lt;&#x2F;script&gt;</pre>
46
 
 
47
 
 
48
 
<p>
49
 
Next, create a new YUI instance for your application and populate it with the
50
 
modules you need by specifying them as arguments to the <code>YUI().use()</code> method.
51
 
YUI will automatically load any dependencies required by the modules you
52
 
specify.
53
 
</p>
54
 
 
55
 
<pre class="code prettyprint">&lt;script&gt;
56
 
&#x2F;&#x2F; Create a new YUI instance and populate it with the required modules.
57
 
YUI().use(&#x27;json-parse&#x27;, &#x27;json-stringify&#x27;, function (Y) {
58
 
    &#x2F;&#x2F; JSON is available and ready for use. Add implementation
59
 
    &#x2F;&#x2F; code here.
60
 
});
61
 
&lt;&#x2F;script&gt;</pre>
62
 
 
63
 
 
64
 
<p>
65
 
For more information on creating YUI instances and on the
66
 
<a href="http://yuilibrary.com/yui/docs/api/classes/YUI.html#method_use"><code>use()</code> method</a>, see the
67
 
documentation for the <a href="../yui/index.html">YUI Global Object</a>.
68
 
</p>
69
 
 
70
 
                
71
 
<h2 id="using">Using the JSON Utility</h2>
72
 
 
73
 
<h3 id="modules">JSON module overview</h3>
74
 
 
75
 
<p>
76
 
    The JSON module adds the namespace <code>JSON</code> to your YUI instance.
77
 
    Its methods are static, available from this namespace.
78
 
</p>
79
 
 
80
 
<p>
81
 
    To minimize the code footprint when some functionality is not required,
82
 
    JSON has been broken up into the following modules:
83
 
</p>
84
 
 
85
 
<dl>
86
 
    <dt><code>json-parse</code></dt>
87
 
    <dd>
88
 
        Adds <code>Y.JSON.parse(..)</code> method to the YUI instance.  Use
89
 
        this module if all you will be doing is parsing JSON strings.
90
 
    </dd>
91
 
 
92
 
    <dt><code>json-stringify</code></dt>
93
 
    <dd>
94
 
        Adds <code>Y.JSON.stringify(..)</code> method and its supporting
95
 
        methods and properties to the YUI instance.  Use this module if all you
96
 
        will be doing is serializing JavaScript objects to JSON strings.
97
 
    </dd>
98
 
 
99
 
    <dt><code>json</code></dt>
100
 
    <dd>
101
 
        A rollup of <code>json-parse</code> and <code>json-stringify</code>
102
 
        modules.  Use this if you need to both parse JSON strings and serialize
103
 
        objects to JSON strings.
104
 
    </dd>
105
 
</dl>
106
 
 
107
 
<h3 id="parse">Parsing JSON strings into native JavaScript values</h3>
108
 
 
109
 
<p>
110
 
    Provided a string containing data in JSON format, simply pass the string to
111
 
    <code>parse</code> and capture the return value.
112
 
</p>
113
 
 
114
 
<pre class="code prettyprint">YUI().use(&#x27;json-parse&#x27;, function (Y) {
115
 
 
116
 
var jsonString = &#x27;{&quot;products&quot;:[&#x27;+
117
 
    &#x27;{&quot;id&quot;:1,&quot;price&quot;:0.99,&quot;inStock&quot;:true,&quot;name&quot;:&quot;grapes&quot;},&#x27;+
118
 
    &#x27;{&quot;id&quot;:2,&quot;price&quot;:3.5,&quot;inStock&quot;:false,&quot;name&quot;:&quot;passion fruit&quot;},&#x27;+
119
 
    &#x27;{&quot;id&quot;:3,&quot;price&quot;:2.5,&quot;inStock&quot;:true,&quot;name&quot;:&quot;bananas&quot;}&#x27;+
120
 
&#x27;]}&#x27;;
121
 
 
122
 
&#x2F;&#x2F; JSON.parse throws a SyntaxError when passed invalid JSON
123
 
try {
124
 
    var data = Y.JSON.parse(jsonString);
125
 
}
126
 
catch (e) {
127
 
    alert(&quot;Invalid product data&quot;);
128
 
}
129
 
 
130
 
&#x2F;&#x2F; We can now interact with the data
131
 
for (var i = data.products.length - 1; i &gt;= 0; --i) {
132
 
    var p = data.products[i];
133
 
    if (p.price &lt; 1) {
134
 
        p.price += 1; &#x2F;&#x2F; Price increase!
135
 
    }
136
 
}
137
 
 
138
 
});</pre>
139
 
 
140
 
 
141
 
<h4 id="reviver">Using the &quot;reviver&quot; parameter</h4>
142
 
 
143
 
<p>
144
 
    The optional second parameter to <code>parse</code> accepts a function that
145
 
    will be executed on each member of the parsed JavaScript object.  Each call
146
 
    to the reviver function is passed the key and associated value, and is
147
 
    executed from the context of the object containing the key.  If the return
148
 
    value of the reviver is <code>undefined</code>, the key will be omitted
149
 
    from the returned object.
150
 
</p>
151
 
 
152
 
<p>
153
 
    Typical uses of reviver functions are filtering, formatting, and value
154
 
    conversion.
155
 
</p>
156
 
 
157
 
 
158
 
<pre class="code prettyprint">YUI().use(&#x27;json-parse&#x27;, function (Y) {
159
 
 
160
 
    var jsonString = &#x27;{&quot;products&quot;:[&#x27;+
161
 
        &#x27;{&quot;id&quot;:1,&quot;price&quot;:0.99,&quot;inStock&quot;:true,&quot;name&quot;:&quot;grapes&quot;},&#x27;+
162
 
        &#x27;{&quot;id&quot;:2,&quot;price&quot;:3.5,&quot;inStock&quot;:false,&quot;name&quot;:&quot;passion fruit&quot;},&#x27;+
163
 
        &#x27;{&quot;id&quot;:3,&quot;price&quot;:2.5,&quot;inStock&quot;:true,&quot;name&quot;:&quot;bananas&quot;}&#x27;+
164
 
    &#x27;]}&#x27;;
165
 
 
166
 
    &#x2F;&#x2F; Remove all out of stock entries and bananas.  Format prices.
167
 
    var currencySymbol = &#x27;$&#x27;;
168
 
    var reviver = function (key,val) {
169
 
        if (key === &#x27;inStock&#x27; &amp;&amp; !val) {
170
 
            return undefined;
171
 
        } else if (val === &#x27;bananas&#x27;) {
172
 
            return undefined;
173
 
        } else if (key === &#x27;price&#x27;) {
174
 
            val += val % 1 ? &quot;0&quot; : &quot;.00&quot;;
175
 
            var pIdx = val.indexOf(&#x27;.&#x27;);
176
 
            val = pIdx ? &quot;0&quot; + val : val;
177
 
            val = currencySymbol + val.substr(0,pIdx + 3);
178
 
        }
179
 
 
180
 
        return val;
181
 
    };
182
 
 
183
 
    &#x2F;&#x2F; JSON.parse throws a SyntaxError when passed invalid JSON
184
 
    try {
185
 
        var data = Y.JSON.parse(jsonString,reviver);
186
 
    }
187
 
    catch (e) {
188
 
        alert(&quot;Invalid product data&quot;);
189
 
    }
190
 
 
191
 
    &#x2F;&#x2F; We can now interact with the data
192
 
    alert(data.products.length); &#x2F;&#x2F; 1
193
 
    alert(data.products[0].price); &#x2F;&#x2F; $0.99
194
 
 
195
 
});</pre>
196
 
 
197
 
 
198
 
<h4 id="avoid_eval">A word of caution against using <code>eval</code></h4>
199
 
 
200
 
<p>
201
 
    JSON data format is a <em>subset</em> of JavaScript notation, meaning that
202
 
    it is possible to use JavaScript <code>eval</code> to transform JSON data
203
 
    to live data.  However, it is unsafe practice to assume that data reaching
204
 
    your code is not malicious.  <code>eval</code> is capable of executing
205
 
    JavaScript's full syntax, including calling functions and accessing cookies
206
 
    with all the privileges of a <code>&lt;script&gt;</code>.  To ensure that
207
 
    the data is safe, the JSON module's <code>parse</code> method inspects the
208
 
    incoming string (using methods derived from Douglas Crockford's <a
209
 
    href="https://github.com/douglascrockford/JSON-js/blob/master/json2.js">json2.js</a>)
210
 
    and verifies that it is safe before giving it the green light to parse.
211
 
</p>
212
 
 
213
 
<pre class="code prettyprint">&#x2F;&#x2F; UNSAFE
214
 
var data = eval(&#x27;(&#x27; + shouldBeJsonData + &#x27;)&#x27;);
215
 
 
216
 
&#x2F;&#x2F; Safe
217
 
var data = Y.JSON.parse(shouldBeJsonData);</pre>
218
 
 
219
 
 
220
 
<h3 id="stringify">Creating JSON strings from JavaScript objects</h3>
221
 
 
222
 
<p>
223
 
    To convert a JavaScript object (or any permissable value) to a JSON string,
224
 
    pass that object to <code>Y.JSON.stringify</code> and capture the returned
225
 
    string.
226
 
</p>
227
 
 
228
 
<pre class="code prettyprint">YUI().use(&quot;json-stringify&quot;, function (Y) {
229
 
 
230
 
    var myData = {
231
 
        troop : [
232
 
            { name: &quot;Ashley&quot;, age: 12 },
233
 
            { name: &quot;Abby&quot;, age:9 }
234
 
        ]
235
 
    }; 
236
 
 
237
 
    var jsonStr = Y.JSON.stringify(myData);
238
 
 
239
 
    alert(jsonStr); &#x2F;&#x2F; {&quot;troop&quot;:[{&quot;name&quot;:&quot;Ashley&quot;,&quot;age&quot;:12},{&quot;name&quot;:&quot;Abby&quot;,&quot;age&quot;:9}]}
240
 
});</pre>
241
 
 
242
 
 
243
 
<h4 id="whitelist">Using a whitelist</h4>
244
 
 
245
 
<p>
246
 
    To serialize only a fixed subset of keys, provide an array of key names as
247
 
    the second parameter to <code>stringify</code>.
248
 
</p>
249
 
 
250
 
<pre class="code prettyprint">YUI().use(&quot;json-stringify&quot;, function (Y) {
251
 
 
252
 
    &#x2F;&#x2F; a detailed object record set
253
 
    var records = [
254
 
        {id:1, name: &quot;Bob&quot;,   age: 47, favorite_color: &quot;blue&quot;},
255
 
        {id:2, name: &quot;Sally&quot;, age: 30, favorite_color: &quot;mauve&quot;},
256
 
        {id:3, name: &quot;Tommy&quot;, age: 13, favorite_color: &quot;black&quot;},
257
 
        {id:4, name: &quot;Chaz&quot;,  age: 26, favorite_color: &quot;plaid&quot;}
258
 
    ];
259
 
 
260
 
    &#x2F;&#x2F; Use an array of acceptable object key names as a whitelist.
261
 
    &#x2F;&#x2F; To create a JSON string with only age and id
262
 
    var jsonStr = Y.JSON.stringify(records,[&quot;id&quot;,&quot;age&quot;]);
263
 
 
264
 
    alert(jsonStr);
265
 
    &#x2F;&#x2F; [{&quot;id&quot;:1,&quot;age&quot;:47},{&quot;id&quot;:2,&quot;age&quot;:30},{&quot;id&quot;:3,&quot;age&quot;:13},{&quot;id&quot;:4,&quot;age&quot;:26}]
266
 
 
267
 
});</pre>
268
 
 
269
 
 
270
 
<h4 id="replacer">Using a custom &quot;replacer&quot; function</h4>
271
 
 
272
 
<p>
273
 
    For more granular control of how values in your object are serialized, you
274
 
    can pass a replacer function as the second parameter to
275
 
    <code>stringify</code>.  The replacer will be called for each key value
276
 
    pair, and executed from the context of the key's host object.  The return
277
 
    value of the replacer will be serialized in place of the raw value.
278
 
</p>
279
 
 
280
 
<pre class="code prettyprint">YUI().use(&quot;json-stringify&quot;, function (Y) {
281
 
 
282
 
    &#x2F;&#x2F; a detailed object record set
283
 
    var records = [
284
 
        {id:1, name: &quot;Bob&quot;,   birthdate: &quot;2&#x2F;27&#x2F;1964&quot;, favorite_color: &quot;blue&quot;},
285
 
        {id:2, name: &quot;Sally&quot;, birthdate: &quot;9&#x2F;30&#x2F;1983&quot;, favorite_color: &quot;mauve&quot;},
286
 
        {id:3, name: &quot;Tommy&quot;, birthdate: &quot;3&#x2F;11&#x2F;1990&quot;, favorite_color: &quot;black&quot;},
287
 
        {id:4, name: &quot;Chaz&quot;,  birthdate: &quot;5&#x2F;22&#x2F;1975&quot;, favorite_color: &quot;plaid&quot;}
288
 
    ];
289
 
 
290
 
    &#x2F;&#x2F; Create a replacer to blacklist the id and convert the birthdate to a Date
291
 
    var replacer = function (key,val) {
292
 
        &#x2F;&#x2F; blacklist id and favorite_color
293
 
        if (key === &#x27;id&#x27; || key === &#x27;favorite_color&#x27;) {
294
 
            return undefined;
295
 
 
296
 
        &#x2F;&#x2F; convert birthdate to a Date instance (serialized as UTC date string)
297
 
        } else if (key === &#x27;birthdate&#x27;) {
298
 
            var d = new Date(),
299
 
                bd = val.split(&#x27;&#x2F;&#x27;);
300
 
            d.setFullYear(bd[2],bd[0]-1,bd[1]);
301
 
            d.setHours(0,0,0);
302
 
            return d;
303
 
        }
304
 
 
305
 
        return val;
306
 
    };
307
 
 
308
 
    var jsonStr = Y.JSON.stringify(records,replacer);
309
 
 
310
 
    alert(jsonStr);
311
 
    &#x2F;&#x2F; [{&quot;name&quot;:&quot;Bobby&quot;,&quot;birthdate&quot;:&quot;1964-02-28T08:00:00Z&quot;},{&quot;name&quot;:&quot;Sally&quot;,&quot;birthdate&quot;:&quot;1983-09-30T07:00:00Z&quot;},{&quot;name&quot;:&quot;Tommy&quot;,&quot;birthdate&quot;:&quot;1990-03-11T08:00:00Z&quot;},{&quot;name&quot;:&quot;Chaz&quot;,&quot;birthdate&quot;:&quot;1975-05-23T07:00:00Z&quot;}]
312
 
 
313
 
});</pre>
314
 
 
315
 
 
316
 
<h4 id="format">Formatting JSON output</h4>
317
 
 
318
 
<p>
319
 
    To create readable JSON, pass a string or number as the third parameter to
320
 
    <code>stringify</code>.  Object and Array members will be separated with
321
 
    newlines and indented.  If a string is supplied, that string will be used
322
 
    for the indentation.  If a number is passed, that number of spaces will be
323
 
    used.
324
 
</p>
325
 
 
326
 
<pre class="code prettyprint">YUI().use(&#x27;json-stringify&#x27;, function (Y) {
327
 
 
328
 
    var fam = {
329
 
        family: &quot;Franklin&quot;,
330
 
        children: [ &quot;Bob&quot;, &quot;Emily&quot;, &quot;Sam&quot; ]
331
 
    };
332
 
 
333
 
    &#x2F;&#x2F; format serialization with four spaces
334
 
    var jsonStr = Y.JSON.stringify(fam,null,4);
335
 
 
336
 
    alert(jsonStr);
337
 
    &#x2F;*
338
 
    {
339
 
        &quot;family&quot;: &quot;Franklin&quot;,
340
 
        &quot;children&quot;: [
341
 
            &quot;Bob&quot;,
342
 
            &quot;Emily&quot;,
343
 
            &quot;Sam&quot;
344
 
        ]
345
 
    }
346
 
    *&#x2F;
347
 
 
348
 
});</pre>
349
 
 
350
 
 
351
 
<h3 id="errors">Catching JSON errors</h3>
352
 
 
353
 
<p>
354
 
    ECMA 5 states that <code>parse</code> should throw an error when an invalid
355
 
    JSON string is input.  It also states that <code>stringify</code> should
356
 
    throw an error when an object with cyclical references is input.
357
 
</p>
358
 
 
359
 
<p>
360
 
    For this reason, it is recommended that both <code>parse</code> and
361
 
    <code>stringify</code> be called from within
362
 
    <code>try</code>/<code>catch</code> blocks.
363
 
</p>
364
 
 
365
 
<pre class="code prettyprint">try {
366
 
    &#x2F;&#x2F; BOOM
367
 
    Y.JSON.parse(&quot;{&#x27;this string&#x27;: is, not_valid: [&#x27;J&#x27;,&#x27;S&#x27;,&#x27;O&#x27;,&#x27;N&#x27;] }&quot;);
368
 
}
369
 
catch (e) {
370
 
    alert(&quot;A string may eval to the same object, but might not be valid JSON&quot;);
371
 
}
372
 
 
373
 
&#x2F;&#x2F; This is safe to stringify
374
 
var myData = {
375
 
    troop : [
376
 
        { name: &quot;Ashley&quot;, age: 12 },
377
 
        { name: &quot;Abby&quot;, age:9 }
378
 
    ]
379
 
}; 
380
 
 
381
 
&#x2F;&#x2F; Create a cyclical reference
382
 
myData.troop[0][&quot;NEWKEY&quot;] = myData;
383
 
 
384
 
try {
385
 
    &#x2F;&#x2F; BOOM
386
 
    jsonStr = Y.JSON.stringify(myData);
387
 
} catch (e) {
388
 
    alert(&quot;Cyclical references can sneak in.  Remember to wrap stringify.&quot;);
389
 
}</pre>
390
 
 
391
 
 
392
 
<h3 id="native">Notes about current native JSON support</h3>
393
 
 
394
 
<p>
395
 
    Native JSON support in JavaScript is defined in the ECMAScript 5
396
 
    specification, which was finalized in September 2009.  However, most of the
397
 
    major browser vendors had already implemented this feature in recent
398
 
    versions of their JavaScript engines while the spec was still in draft.  As
399
 
    a result of the timing and the fact that native JSON is a new feature,
400
 
    there are gotchas involved in leveraging the disparate native
401
 
    behaviors.
402
 
</p>
403
 
 
404
 
<p>
405
 
    In general, it is preferable to use the native behavior for
406
 
    <code>JSON.parse</code> as it is much faster and safer than any JavaScript
407
 
    implementation.  There are also very few known critical issues with
408
 
    supporting browsers.
409
 
</p>
410
 
 
411
 
 
412
 
<p>
413
 
    Stringify has more pitfalls and inconsistencies, but they may not affect
414
 
    your use cases.  As with <code>parse</code>, the native implementation of
415
 
    <code>stringify</code> is faster, but only marginally so with reasonably
416
 
    sized input.  In most cases, choosing the JavaScript implementation will
417
 
    not affect performance and may be preferable for its cross browser
418
 
    consistency.
419
 
</p>
420
 
 
421
 
 
422
 
<p>
423
 
    As noted above, the JSON module will leverage native behavior in
424
 
    implementing browsers by default.  However, you can choose to opt out of
425
 
    leveraging native <code>parse</code> or <code>stringify</code> by setting
426
 
    the <code>Y.JSON.useNativeParse</code> and
427
 
    <code>Y.JSON.useNativeStringify</code> static properties.
428
 
</p>
429
 
 
430
 
 
431
 
<pre class="code prettyprint">YUI().use(&#x27;json&#x27;, function (Y) {
432
 
 
433
 
    &#x2F;&#x2F; Always use the JavaScript implementation for parsing
434
 
    Y.JSON.useNativeParse = false;
435
 
 
436
 
    &#x2F;&#x2F; Always use the JavaScript implementation for stringifying
437
 
    Y.JSON.useNativeStringify = false;
438
 
 
439
 
    &#x2F;&#x2F;...
440
 
});</pre>
441
 
 
442
 
</div>
443
 
            </div>
444
 
        </div>
445
 
 
446
 
        <div class="yui3-u-1-4">
447
 
            <div class="sidebar">
448
 
                
449
 
                    <div id="toc" class="sidebox">
450
 
                        <div class="hd">
451
 
                            <h2 class="no-toc">Table of Contents</h2>
452
 
                        </div>
453
 
 
454
 
                        <div class="bd">
455
 
                            <ul class="toc">
456
 
<li>
457
 
<a href="#getting-started">Getting Started</a>
458
 
</li>
459
 
<li>
460
 
<a href="#using">Using the JSON Utility</a>
461
 
<ul class="toc">
462
 
<li>
463
 
<a href="#modules">JSON module overview</a>
464
 
</li>
465
 
<li>
466
 
<a href="#parse">Parsing JSON strings into native JavaScript values</a>
467
 
<ul class="toc">
468
 
<li>
469
 
<a href="#reviver">Using the &quot;reviver&quot; parameter</a>
470
 
</li>
471
 
<li>
472
 
<a href="#avoid_eval">A word of caution against using <code>eval</code></a>
473
 
</li>
474
 
</ul>
475
 
</li>
476
 
<li>
477
 
<a href="#stringify">Creating JSON strings from JavaScript objects</a>
478
 
<ul class="toc">
479
 
<li>
480
 
<a href="#whitelist">Using a whitelist</a>
481
 
</li>
482
 
<li>
483
 
<a href="#replacer">Using a custom &quot;replacer&quot; function</a>
484
 
</li>
485
 
<li>
486
 
<a href="#format">Formatting JSON output</a>
487
 
</li>
488
 
</ul>
489
 
</li>
490
 
<li>
491
 
<a href="#errors">Catching JSON errors</a>
492
 
</li>
493
 
<li>
494
 
<a href="#native">Notes about current native JSON support</a>
495
 
</li>
496
 
</ul>
497
 
</li>
498
 
</ul>
499
 
                        </div>
500
 
                    </div>
501
 
                
502
 
 
503
 
                
504
 
                    <div class="sidebox">
505
 
                        <div class="hd">
506
 
                            <h2 class="no-toc">Examples</h2>
507
 
                        </div>
508
 
 
509
 
                        <div class="bd">
510
 
                            <ul class="examples">
511
 
                                
512
 
                                    
513
 
                                        <li data-description="Use JSON to parse data received via XMLHttpRequest via Y.io calls — a simple JSON use case.">
514
 
                                            <a href="json-connect.html">JSON with Y.io</a>
515
 
                                        </li>
516
 
                                    
517
 
                                
518
 
                                    
519
 
                                        <li data-description="Use the replacer and reviver parameters to reconstitute object instances that have been serialized to JSON.">
520
 
                                            <a href="json-freeze-thaw.html">Rebuilding Class Instances from JSON Data</a>
521
 
                                        </li>
522
 
                                    
523
 
                                
524
 
                                    
525
 
                                        <li data-description="Use a currency conversion calculation to add a new price member to a JSON response, demonstrating how JSON data, once retrieved, can be transformed during parsing.">
526
 
                                            <a href="json-convert-values.html">Adding New Object Members During Parsing</a>
527
 
                                        </li>
528
 
                                    
529
 
                                
530
 
                                    
531
 
                                
532
 
                                    
533
 
                                
534
 
                            </ul>
535
 
                        </div>
536
 
                    </div>
537
 
                
538
 
 
539
 
                
540
 
                    <div class="sidebox">
541
 
                        <div class="hd">
542
 
                            <h2 class="no-toc">Examples That Use This Component</h2>
543
 
                        </div>
544
 
 
545
 
                        <div class="bd">
546
 
                            <ul class="examples">
547
 
                                
548
 
                                    
549
 
                                
550
 
                                    
551
 
                                
552
 
                                    
553
 
                                
554
 
                                    
555
 
                                        <li data-description="A basic todo list built with the Model, Model List, and View components.">
556
 
                                            <a href="../app/app-todo.html">Todo List</a>
557
 
                                        </li>
558
 
                                    
559
 
                                
560
 
                                    
561
 
                                        <li data-description="Portal style example using Drag &amp; Drop Event Bubbling and Animation.">
562
 
                                            <a href="../dd/portal-drag.html">Portal Style Example</a>
563
 
                                        </li>
564
 
                                    
565
 
                                
566
 
                            </ul>
567
 
                        </div>
568
 
                    </div>
569
 
                
570
 
            </div>
571
 
        </div>
572
 
    </div>
573
 
</div>
574
 
 
575
 
<script src="../assets/vendor/prettify/prettify-min.js"></script>
576
 
<script>prettyPrint();</script>
577
 
 
578
 
</body>
579
 
</html>