I am using the GeoJsonSerializer as I need to serialize several geomtetries.
JsonSerializerSettings sett = new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }; // ignore Self referencing loop
var serializer = GeoJsonSerializer.Create(sett);
serializer.Formatting = Newtonsoft.Json.Formatting.Indented; //pretty print
using (StreamWriter file = File.CreateText(jsonFile))
{
serializer.Serialize(file, cities);
}
and my class has this:
[JsonIgnore]
[NotMapped]
public string? OriginalSource { get; set; } = "UNK";
[XmlIgnore] // tempo
[JsonIgnore] // tempo
[DisplayFormat(NullDisplayText = "Null")]
public NetTopologySuite.Geometries.Point? Location { get; set; }
Yet these fields still end up in my JSON output. Is there another attribute that I am missing?