The goal is to read/write json files that contain custom properties. The typical advice is to use the ExtensionDataObject class. However, I can't find any information online as to how I actually read/write the data to this object. I have run a test using the following json:
{
"Hello": "World"
}
and with a datatype:
public class ExtData : IExtensibleDataObject
{
public ExtensionDataObject ExtensionData { get; set; }
public ExtData()
{
}
}
Then using the following code to read the file:
DataContractJsonSerializer ds = new DataContractJsonSerializer(typeof(ExtData));
ExtData ed = null;
using(StreamReader sr = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + "\\test.json"))
{
ed = (ExtData)ds.ReadObject(sr.BaseStream);
}
When debugging, if I apply a breakpoint just after the assignment of 'ed' I can see that there is an object in the 'Members' collection of this ExtensionDataObject. Only being able to see the data when debugging is less than ideal. Is there another class designed to read/write this data?