An advanced serialization system which converts JavaScript objects, including their functions into and from a JSON-compatible data structure.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
index.js
package.json

README.md

superserialize

superserialize is an advanced serialization system, which allows you to serialize JavaScript objects, including their functions, into a JSON-compatible data structure. the JSON can then be sent across a socket, HTTP, or whatever you wish. Once the JSON has been sent to the destination, superserialize can then deserialize it back into a JavaScript object, complete with working functions.

Installation

npm install superserialize

You can use superserialize in browser JavaScript with the browserify module

Usage Example

var serialize = require('superserialize').serialize,
	deseralize = require('superserialize').deserialize;
	
var TestObject = {
	sayHello: function(name) {
		console.log(name + ": Hi there!");
	}
};

var serialized = serialize(TestObject);

console.log(serialized); // This will output a JSON-compatible object

var deserialized = deserialize(serialized);

deserialize.sayHello("Bob"); // This will output "Bob: Hi there!" as expected!

License

superserialize was created by Jesse Dunlap, and is licensed under the MIT license.