Self referencing loop detected for property 'xxxx' with type 'System.Data.Entity.DynamicProxies.XXX_XXX'. Newtonsoft.Json.JsonSerializationException

This is a very common serialization exception we see when forget to use loop handling strategies in Web API.

Look at the below screenshot which you have noticed:

Now if you want to resolve this issue, you can use following code in web api configuration, here's how you can resolve this issue:

var json = config.Formatters.JsonFormatter;
json.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;

Here's the complete code snippet screenshot:

Hope this helps you.


Popular posts from this blog

Migrating database from ASP.NET Identity to ASP.NET Core Identity

Customize User's Profile in ASP.NET Identity System

Lambda two tables and three tables inner join code samples