I'm having difficulties using Newtonsoft
when it comes to serialize objects that came from the server side.
I have a collection List<ObjectExample>
with two elements, if some of those elements of that ObjectExample are the same, it only serializes one of them.
Examples below:
(since "Nome da Entidade" or "Tipo de Entidade" are different it shows, if not it only show one, but they are different.)
"Nome da Entidade" and "Tipo de Entidade" are referenced to tables in database.
I'm using linq to return the values and then serialize them like this:
json = JsonConvert.SerializeObject(ins /*LIST*/, Formatting.Indented,
new JsonSerializerSettings
{
PreserveReferencesHandling = PreserveReferencesHandling.Objects,
DefaultValueHandling = DefaultValueHandling.Include,
ObjectCreationHandling = ObjectCreationHandling.Auto
});