1

In ASP.NET MVC, Can I go beyond the max length of JSON?

var jsonResult = Json(data, JsonRequestBehavior.AllowGet);
jsonResult.MaxJsonLength = int.MaxValue;
return jsonResult;

My data here is greater than max value. If no, how can I send the data to the caller of the method?

Alexander Paes
  • 101
  • 4
  • 13
  • How big is the data you're trying to send? I wouldn't choose Json for sending over 2GB... – C.Evenhuis Nov 14 '17 at 20:38
  • Check this link, [Can I set an unlimited length for maxJsonLength in web.config? ASP.Net-MVC](https://stackoverflow.com/questions/1151987/can-i-set-an-unlimited-length-for-maxjsonlength-in-web-config/7207539) – Shark01 Nov 14 '17 at 21:00
  • @C.Evenhuis, How do you send it if your data is over 2 GB? Are you suggesting octet-stream? If no, can you also suggest some best ways of sending such large data? – Alexander Paes Nov 14 '17 at 21:26
  • Split it up into smaller packets. –  Nov 14 '17 at 22:02
  • @AlexanderPaes I'd definitely go for octet-stream if this was binary data base64'd into a json response. And if you're sending structured data with millions of elements, chances are that the property names in the Json take up more bytes than the actual values. Sometimes another possibility is to allow the bigger parts of the data to be downloaded separately, and include Url's to them in your json. But that all depends on the scenario you're dealing with, and I don't now anything about. – C.Evenhuis Nov 14 '17 at 22:23

0 Answers0