fjson
v0.2.1b
Published
FunkyJSON is an extension of JSON that allows for the transferring of functions and Regular Expressionsvia JSON.
Downloads
10
Readme
FunkyJSON
FunkyJSON (FJSON) is an extension of the JSON that allows for the transmission of functions via JSON. The need to serialize functions into JSON was necessary to solve certains issues we were having so we developed a mean to serialize functions and parse them. FJSON is a very simple library.
How It Works
FJSON takes a function and converts into a serializable object. For example, assume the object:
var hello = function(name) {
console.log(name);
};
Would be converted to the following serializable object:
{
"FUNCTION": true,
"params": [""],
"body": "console.log(name);"
}
How to Use It
Installation
Install via NPM easily with npm install fjson
or globally with npm install -g fjson
Usage
Once installed require in your code file easily: var FJSON = require("fjson");
From here you can use the variable you stored the library into (in the above example it's FJSON
) or you
can use the same functions on the JSON object.
Use FJSON.funkify(obj);
to serialize the object as a string (including functions) and use
FJSON.unfunkify(str);
to convert a FJSON string into an object.
FJSON should be usable in a browser but this is untested.
Author
Brandon Buck [email protected]
License
This software is licensed under the Affero General Public License which can be found here.