开发者

Problem sending JSON object to jQuery

开发者 https://www.devze.com 2023-03-13 17:39 出处:网络
When I was trying to send the JSON object to the jQuery, I return the whole query result , then I get an error saying \" A circular reference was detected while serializing an object of type \'aspnet_

When I was trying to send the JSON object to the jQuery, I return the whole query result , then I get an error saying " A circular reference was detected while serializing an object of type 'aspnet_User'." However when I return parts of the table like

       select  new
          开发者_如何学Python           {
                         n.CustomerID,
                         n.EndDate,
                         n.BeginDate
                     });
        });

in this case I can see the values being retrieved. Please help me with the problem?


If you have a set of classes like

class User {
   Account account;
}
class Account {
  User user;
}

And you send them to a serializer, then then serializer will forever be in a loop. It will serialize User -> User's Account -> Account's User -> User's Account. The serializer detects this problem and throws and error. Instead if you have User with no account or Account with no user it shouldn't be a problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号