Debian Codegraph @

jsonpickleJS/testUnpickle.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns = "http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5 <script data-main="main" src="ext/require/require.js"></script>
6
7 </head>
8 <body>
9 <script type="text/javascript">
10 require(['main'], function (jsonpickle) {
11 Thing = function (x) {
12 this.x = x;
13 }
14 var json = [];
15 json[0] = '[[5, 6, 7], {"py/id": 1}, {"hi": 8, "bye": {"py/id": 1}}, {"py/object": "__main__.Thing", "x": {"py/id": 1}}]';
16 json[1] = '{"py/object": "fractions.Fraction", "_denominator": 3, "_numerator": 1}';
17 o = jsonpickle.decode(json[0]);
18 console.log(o);
19 });
20 </script>
21 See Console for output...
22 </body>
23 </html>