I recently ran into an annoying problem. I am going to simplify my database here, but the principle is the same. I have a class "User". In this class, I have a property that is a list of objects that the user owns. I also have this class "object". Since each "object" has an owner, it has a property of type "User", which refers to its owner. Now, what I'm trying to do is basically
return Json(myUser,JsonRequestBehavior.AllowGet);
When I load the page, it takes 30 seconds, and then I get the error "RecursionLimit above".
I assume that this is due to the fact that objects are related to each other. Now my question is: how can I say "Json" that it should not go deeper than level 1 objects to avoid this?
c # asp.net-mvc-3
Anton Gildebrand
source share