Monday, February 18, 2013

Nancy.Json.JsonSettings.MaxJsonLength Exceeded

I was working on the web app which reads data from MongoDB and return the results to the UI as Jason using nancy. However I experienced the following error while returning a large chunk of data:-

Nancy.Json.JsonSettings.MaxJsonLength Exceeded

The data returned was so huge that it exceeded the max jason length (102400). The good news is that you can increase the max json length so that it caters for large amounts of data, this is how you can do this using c# :-

 JsonSettings.MaxJsonLength = Int32.MaxValue;

The above code will increase the max length from 102,400 to 2,147, 483, 647

No comments:

Post a Comment