I have created a custom label object in c# and I need to make json object from this object. But I have derived the Label from the 'Label' control to custom label object. After serializing custom label object, json is getting filled with label properties. But, I don't need it. I need to pass only the custom label object.
This is custom label :
public class customLabel:Label
{
public string X { get; set; }
public string Y { get; set; }
public string H { get; set; }
public string W { get; set; }
public string FontName { get; set; }
public string FontSize { get; set; }
public string Type { get; set; }
public string Align { get; set; }
public string _Text { get; set; }
}
I am using Newtonsoft.Json for json serializng
Labelso, it is a label too.this values? You can pass any object to JSON.NET. Objects will always be serialized as dictionaries. Did you try it? What code did you use? What did you get and what did you expect?