public static void Serialize(JsonWriter writer, object obj)
 {
     SerializeInternal(writer, obj);
     writer.Flush();
     writer.Close();
 }