4
votes

Im working with asp .net MVC3 . I'm using Newtonsoft.Json.JsonConvert.SerializeObject method for parsing json object . Im Im getting Error "Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property."

I have also tried settings in web.config to max length . But ,No gain.

Kindly assist me .

Thanks

1

1 Answers

0
votes

On your controller, return your json like this:

var result = //your data;
var jsonResult = Json(result, JsonRequestBehavior.AllowGet);
jsonResult.MaxJsonLength = int.MaxValue;

You can change the MaxJsonLength according to your needs.