using Newtonsoft.Json.Linq;
public static void Main()
JsonData = @"""Prop1"":""Value1"", ""Prop2"":""Value2"", ""Prop3"":""Value3""",
string json = JsonConvert.SerializeObject(mt, Formatting.Indented);
class MyTypeConverter : JsonConverter
public override bool CanConvert(Type objectType)
return objectType == typeof(MyType);
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
MyType mt = (MyType)value;
JObject jo = new JObject();
if (!string.IsNullOrWhiteSpace(mt.JsonData))
jo.Add(JObject.Parse("{" + mt.JsonData + "}").Properties());
foreach (PropertyInfo prop in typeof(MyType).GetProperties()
.Where(p => p.CanRead && p.Name != "JsonData"))
object val = prop.GetValue(mt, null);
jo.Add(prop.Name, val != null ? JToken.FromObject(val, serializer) : JValue.CreateNull());
public override bool CanRead
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
throw new NotImplementedException();
[JsonConverter(typeof(MyTypeConverter))]
public string JsonData { get; set; }
public string OtherProperty { get; set; }