Entity Framework Json Serializer solves the Circular Reference problem when working with Entity Framework and the Asp.NET MVC JsonResult.

It´s very simple to use it, after you make your LINQ to Entities query, you just need to convert to simple object using the JsonHelper:


var jsonObjects = query.ToList().Select(c => JsonHelper.ConvertToSimpleObject(c));
return Json(jsonObjects, JsonRequestBehavior.AllowGet);


See more at documentation.

Support for paths

Sometimes you need to serialize the relationship, using the same syntax for Entity Framework, you can do it using EFJson:


var jsonObjects = query.ToList().Select(c => JsonHelper.ConvertToSimpleObject(c, "Path", "Path1.Path2"));



Download the project to see one example with one table, one relationship, many relationship and multiple paths.

Before run the example restore the Northwind database, the .bkp file is in the EFJson.Web project.


Author Blog

Murilo Dev


Paypal Donate

Last edited Oct 19, 2012 at 2:06 AM by MAGomes, version 11