public String SerializeToJSON(Object obj, bool prettyPrint) { JsonSerializer jsonSer = getCustomSerializer(); using (StringWriter sw = new StringWriter()) { JsonWriter writer = new CamelCasingJsonTextWriter(sw); if (prettyPrint) { writer.Formatting = Formatting.Indented; } jsonSer.Serialize(writer, obj); return sw.ToString(); } }
public string SerializeToJSON(object obj, bool prettyPrint) { JsonSerializer jsonSer = getCustomSerializer(); using (StringWriter sw = new StringWriter()) { JsonWriter writer = new CamelCasingJsonTextWriter(sw); if (prettyPrint) { writer.Formatting = Formatting.Indented; } jsonSer.Serialize(writer, obj); return(sw.ToString()); } }