0

I am getting json error while serializaing.

here is my code.I am appending the list and converting it to json format.

var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
serializer.MaxJsonLength = Int32.MaxValue;
var panelList = new List<List<SearchDto>>();
     StringBuilder str;

        foreach (var item in searchViewModels.SearchList)
        {
            if (item.PanelGroupList != null)
            {
                if (item.PanelGroupList.Count() != 0)
                {
                    str = new StringBuilder();
                    panelList.Add(item.PanelGroupList.ToList());
                    str.Append(serializer.Serialize(panelList))
                }
            }
        }

I have also added following tags in web.config.

<system.web.extensions>
    <scripting>
        <webServices>
            <jsonSerialization maxJsonLength="500000000"/>
        </webServices>
    </scripting>

Aarif Qureshi
  • 474
  • 1
  • 3
  • 13

0 Answers0