Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Christina 127 posts 390 karma points notactivated
    Nov 07, 2020 @ 14:44
    Christina
    0

    Circle reference error serialize object to json

    Hi I hope someone can help me, I want to generate json from a node with children doctype event with a surface controller and i Get Circle reference because in my doctype event I have a List with another doctype Facts . I have tried to create a dto but I don't now how to populate it If someone can point me in right direction. Many Thanks in advance Christina

      public JsonResult GetCalendarData()
            {
                var allevents = Umbraco.Content(1067).Children();
                var eventList = from l in allevents
                 select new
                 {
                      start = l.Value<DateTime>("eventStartDate").ToString(),
                       title = l.Name,
                       description = l.Value("ingress").ToString() ?? "",
                       programs = l.Value("programs") // IEnumerable<Facts> -> time, text
                   };
                var events = eventList.ToArray();
    
                return new JsonResult { Data = events, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
            }
    
Please Sign in or register to post replies

Write your reply to:

Draft