using System.Collections.Generic;
public string name { get; set; }
public bool? isMale { get; set; }
public bool? likesPonies { get; set; }
public static string Serialize(Transaction transactionData)
var serialized = JsonConvert.SerializeObject(transactionData, Formatting.None, new JsonSerializerSettings
{Converters = new List<JsonConverter> { new BoolToStringConverter() },
public static void Main()
var obj = new Transaction()
Console.WriteLine(Serialize(obj));
public class BoolToStringConverter : JsonConverter
public override bool CanConvert(Type objectType)
return objectType == typeof(bool);
public override bool CanRead
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
throw new NotImplementedException();
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
writer.WriteValue(value.GetType() == typeof(bool?) ? "true" : "false");