Here working code Create JSON file for Desktop application :-
private void GenerateJSONFile(List<Works> WorkList)
{
string jsonString = "";
JsonSerializerSettings J = new JsonSerializerSettings();
J.NullValueHandling = NullValueHandling.Ignore;
J.DefaultValueHandling = DefaultValueHandling.Ignore;
J.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
try
{
jsonString = JsonConvert.SerializeObject(WorkList, Newtonsoft.Json.Formatting.Indented, J);
if (!string.IsNullOrEmpty(jsonString))
{
Common.WriteFile(jsonString,Settings.Default.JSONFilePath, Settings.Default.JSONFilename);
}
}
catch (Exception ex)
{
}
}
Now I can do create JSONP file.
Do you know any solutions?
What I have tried:
private void GenerateJSONFile(List<works> WorkList)
{
string jsonString = "";
JsonSerializerSettings J = new JsonSerializerSettings();
J.NullValueHandling = NullValueHandling.Ignore;
J.DefaultValueHandling = DefaultValueHandling.Ignore;
J.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
try
{
jsonString = JsonConvert.SerializeObject(WorkList, Newtonsoft.Json.Formatting.Indented, J);
if (!string.IsNullOrEmpty(jsonString))
{
Common.WriteFile(jsonString,Settings.Default.JSONFilePath, Settings.Default.JSONFilename);
}
}
catch (Exception ex)
{
}
}