| 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 |
tags = jsonpickle.tags; |
| 12 |
|
| 13 |
Thing = function (x) { |
| 14 |
this.x = x; |
| 15 |
this[tags.PY_CLASS] = '__main__.Thing'; |
| 16 |
this.subThing = undefined; |
| 17 |
} |
| 18 |
t = new Thing(5); |
| 19 |
st = new Thing('hello'); |
| 20 |
t.subList = [5, 'a', st]; |
| 21 |
st.subThing = t; |
| 22 |
t.subThing = st; |
| 23 |
t.subThing2 = st; |
| 24 |
o = jsonpickle.encode(t); |
| 25 |
console.log(o); |
| 26 |
}); |
| 27 |
</script> |
| 28 |
See Console for output... |
| 29 |
</body> |
| 30 |
</html> |