Serialise PHP objects into other types of object (json, xml, etc)