function serialize(library, element)
	{
		if (library[element.uuid] === undefined)
		{
			library[element.uuid] = element.toJSON(meta);
		}

		return element.uuid;
	}
Serialize the object data to JSON. Should serialize all attributes and resources used by the object.

Parsing of the data serialized is performed using the ObjectLoader class.

The objects being serialized share a "meta" object where the resources can be stored to avoid repetition in the serialized data.

On the root object the meta object does not need to be initialized manually it is automatically created, to access resource the resourceAccess callback should be used.

@method toJSON
@param {Object} meta Resource storage passed to all resources toJSON for self storage.
@param {Function} resourceAccess Callback method used to access the resources receives (meta, object) as parameters, meta is the resource storage and object is the current serialized status of the object new attributes can be added here.
@param {boolean} recursive If true the method will call toJSON for all available children and store the result in children attribute.
@return {Object} json Output JSON will all data serialized, this can be stores in file or transfered to later be loaded using the ObjectLoader.