I have a mssql database for my website within 4 tables.
When I use this:
public static string GetAllEventsForJSON()
{
using (CyberDBDataContext d
The JsonSerializer instance can be configured to ignore reference loops. Like in the following, this function allows to save a file with the content of the json serialized object:
public static void SaveJson(this T obj, string FileName)
{
JsonSerializer serializer = new JsonSerializer();
serializer.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
using (StreamWriter sw = new StreamWriter(FileName))
{
using (JsonWriter writer = new JsonTextWriter(sw))
{
writer.Formatting = Formatting.Indented;
serializer.Serialize(writer, obj);
}
}
}