Last active
November 15, 2015 18:04
-
-
Save dcleao/dbe9cd3795d5db55a4d5 to your computer and use it in GitHub Desktop.
JSON-Type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // custom JS function serialization/deserialization | |
| // custom date, iso format | |
| // special numbers: +/- Infinity | |
| // undefined value | |
| // --- | |
| // A way to pass more data types through JSON. | |
| // A way to be able to use JSONObject in Java. | |
| // A way of de-serializing without additional metadata. | |
| // A way that can be used with JSON.stringify and JSON.parse. | |
| ({ | |
| foo: {":": "js/fun", "v": "function() {\n return \"foo\";\n}"}, | |
| bar: {":": "date", "v": "2009-08-24T07:30:00Z"}, | |
| guu: {":": "number", "v": "Infinity"}, | |
| und: {":": "undef"}, | |
| // TODO: AMD module class/factory? => async load... => not a good reviver... | |
| // 2 passes? one for collecting dependencies other for resolving? | |
| // Temptatively sync signature. Fails if some module is not already loaded. | |
| // Async signature. | |
| // new Guu(revivedSpec); | |
| dah: {":": "amd:foo/bar/guu", customprop: "", otherprop: ""} | |
| }) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some links about JSON + functions:
http://solutoire.com/2008/06/12/sending-javascript-functions-over-json/
https://github.com/josipk/json-plus