The next JSON extension, "JFON", transfers the functions and properties of the array.
JFON uses eval and is intended to be used if:
1) your data is obtained from a reliable source (for example, not derived from user input or code from your own server) and
2) you know that there are no unwanted side effects with the "eval" context
(this is the context of the eval function in the "fromJFON" function, line 127)
3) it is expensive to refactor your application to use "functionless" JSON;
4) JFON is a one-day job, so additional testing may be required,
Idea: use the selected property name to execute functions and arrays, for example, in strings, when the selected character "\" is used to convey \ n and \ for itself.
In JFON, the name "wrap" is chosen to convey functions and itself: "wrap": {"fun": ... and "wrap": {"esc": ...
demo: http://landkey.org/Sandbox/z/spaceen86/js/btb/tests/jfon.htm
code (use commit 0.0.86):
https://github.com/lancelab/spaceen/blob/master/js/btb/JFON.js
test: github.com/lancelab/spaceen/blob/master/js/btb/tests/jfon.htm
Here is another JWON extension: JSON comments, here are docs, beheading JSONs:
github.com/lancelab/Boardspirator/blob/master/diary/play/tp/jwon.js
source share