Javascript object serializer, for converting Javascript objects to a valid Javascript object string or as XML