Preventing StackOverflowException while serializing Entity Framework object graph into Json
I want to serialize an Entity Framework Self-Tracking Entities full object graph (parent + children in one to many relationships) into Json. For serializing I use ServiceStack.JsonSerializer . This is how my database looks like (for simplicity, I dropped all irrelevant fields): I fetch a full profile graph in this way: public Profile GetUserProfile(Guid userID) { using (var db = new AcmeEntities()) { return db.Profiles.Include("ProfileImages").Single(p => p.UserId == userId); } } The problem is that attempting to serialize it: Profile profile = GetUserProfile(userId); ServiceStack