serialize a Object to his xml Format represenation and create a valid wddx representation

@param object Object to serialize
@return serialized wddx package
@throws ConverterException
977015
public String serialize(Object object) throws ConverterException {
	deep = 0;

	StringBuilder sb = new StringBuilder();
	// if(xmlConform)sb.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>");
	deep++;
	sb.append(_serialize(object, new HashMap<Object, String>()));
	deep--;
	return sb.toString();
    }
276519
public static final String serializeToString(final Object object) {
    if (object == null)
      throw new IllegalArgumentException("Object was null");
    try {
      return jsonMapper.writeValueAsString(object);
    } catch (JsonProcessingException e) {
      throw new JSONException(e);
    }
  }
1170789
public <S, T> T convertTo(ConverterKey<S,T> key, Object object) {

		if (object == null) {
			return null;
		}
		
		Converter<S, T> conv = findConverter(key.getInputClass(), key.getOutputClass(), key.getQualifierAnnotation() == null ? DefaultBinding.class : key.getQualifierAnnotation());
		
		if (conv == null) {
			throw new NoConverterFoundException(key);
		}
		
		@SuppressWarnings("unchecked")
		S myObject = (S)object;
		return conv.convert(myObject);
	}
121654
public String serialize(Object object) {
		XStream xstream = new XStream();
		return xstream.toXML(object);
	}
524464
@SuppressWarnings("unchecked")
    private static String converter(String fieldName, Object object) {
        StringBuilder builder = new StringBuilder();
        if (Checker.isNotEmpty(fieldName)) {
            builder.append("\"").append(fieldName).append("\":");
        }
        if (object instanceof Collection) {
            List list = (List) object;
            builder.append("[");
            list.forEach(obj -> builder.append(converter(ValueConsts.EMPTY_STRING, obj)));
            return builder.substring(0, builder.length() - 1) + "],";
        } else if (object instanceof Map) {
            Map map = (Map) object;
            builder.append("{");
            map.forEach((k, v) -> builder.append(converter(k.toString(), v)));
            return builder.substring(0, builder.length() - 1) + "},";
        } else if (Checker.isEmpty(fieldName)) {
            builder.append("\"").append(object).append("\",");
        } else {
            builder.append("\"").append(object).append("\",");
        }
        return builder.toString();
    }
579952
public static String toJson(Object object) {
        Objects.requireNonNull(object, Required.OBJECT.toString());
        
        String json = null;
        try {
            json = mapper.writeValueAsString(object);
        } catch (JsonProcessingException e) {
            LOG.error("Failed to convert object to json",  e);
        }
        
        return json;
    }
1261585
public static byte[] serialize(Object obj) {
        try(ByteArrayOutputStream bos = new ByteArrayOutputStream();
            ObjectOutputStream oos = new ObjectOutputStream(bos)) {
            oos.writeObject(obj);
            return bos.toByteArray();
        } 
        catch (IOException ex) {
            throw new UncheckedIOException(ex);
        }
    }
564543
public static byte[] serialize(Object instance) throws JsonGenerationException,
            JsonMappingException, IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        mapper.writeValue(out, instance);
        return out.toByteArray();
    }
894613
public String serialize(Object object, String clientVariableName) throws ConverterException {
	StringBuilder sb = new StringBuilder();
	_serialize(clientVariableName, object, sb, new HashSet<Object>());
	String str = sb.toString().trim();
	return clientVariableName + "=" + str + (StringUtil.endsWith(str, ';') ? "" : ";");
	// return sb.toString();
    }
1057959
public void toXml(Object object, OutputStream out, Class<?>... clas) {
		try {
			JAXBContext jaxbContext = JAXBContext.newInstance(clas);
			Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
			// output pretty printed
			jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
			jaxbMarshaller.marshal(object, out);
		} catch (JAXBException e) {
			throw new JKException(e);
		}
	}
376182
@Override
	public String convert(ObjectType sourceObject)
	{
		if(sourceObject == null)
			return null;
		
		String methodName = null;
		Object value =null;
		StringBuilder csv = new StringBuilder();
		Object[] args = {};
		Method m;

		
		for (Entry<String,Method> entry : this.methods.entrySet())
		{
			m = entry.getValue();
			methodName = m.getName();
			
			if(methodName.equals("getClass"))
				continue;
			
			try
			{
				value = m.invoke(sourceObject, args);
				
				if(csv.length() != 0)
					csv.append(SEPARATOR);
				
				csv.append(QUOTE).append(format(value)).append(QUOTE);
				
			}
			catch (IllegalAccessException|IllegalArgumentException|InvocationTargetException e)
			{
				throw new RuntimeException("Unable to get property for method:"+methodName+" error:"+e.getMessage(),e);
			}
		}
		
		csv.append(NEWLINE);
		
		return csv.toString();
		
	}
329968
public static byte[] serialize(FastSerializable object) throws IOException {
        FastSerializer out = new FastSerializer();
        object.writeExternal(out);
        return out.getBBContainer().b().array();
    }
28927
public static String serialise(Object object) {
        Gson gson = getBuilder().create();
        return gson.toJson(object);
    }
51940
public static <T extends Serializable> byte[] serializeObject( T object ) throws IOException {

		ByteArrayOutputStream os = new ByteArrayOutputStream();
		ObjectOutputStream out = new ObjectOutputStream( os );
		out.writeObject( object );

		return os.toByteArray();
	}
448570
public String serialize(T object, boolean includeXmlDeclaration) {
    try {
      Marshaller marshaller = jaxbContext.createMarshaller();
      marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.valueOf(!includeXmlDeclaration));
      JAXBElement<T> element =
          new JAXBElement<T>(qname, clazz, object);
      StringWriter stringWriter = new StringWriter();
      marshaller.marshal(element, stringWriter);
      return stringWriter.toString();
    } catch (JAXBException e) {
      throw new SerializationException(String.format("Could not serialize object: %s.", object), e);
    }
  }
1275612
protected function serializerFor($object): ObjectXmlSerializer
    {
        if (!annotationsOf($object)->contain('XmlSerializer')) {
            return AnnotationBasedObjectXmlSerializer::fromObject($object);
        }

        return $this->injector->getInstance(
                annotationsOf($object)
                        ->firstNamed('XmlSerializer')
                        ->getValue()
                        ->getName()
        );
    }
741320
public <S, T> T convertTo(Class<S> input, Class<T> output, Object object) {
		return convertTo(new ConverterKey<S,T>(input, output, DefaultBinding.class), object);
	}