Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Is there any limit for JSON size in post method?
I didnt get a proper answer from any site.:(

as per th below site, the default limit is 8K and maximum is 2MB is that correct ?

[Json Limit]

I think we can set the limit of input json in wcf service using <requestlimits maxallowedcontentlength="10000">.

So is there any limit for JSON data in service?

What I have tried:

I have tried to find the answer in different sites, but its confusing.
as per below site, there is no limit for Json
http://stackoverflow.com/questions/1262376/is-there-a-limit-on-how-much-json-can-hold

but in some other site they are saying default limit is 8k (8000 characters) and maximum is 2MB ?
Posted
Updated 14-Mar-19 10:17am
v2

There is no limit on JSON but the limitation is down to the data stores involved where you store the data.
 
Share this answer
 
Hello,
There is no limit for JSON data.
JSON is similar to other data formats like XML - if you need to transmit more data, you just send more data. There's no inherent size limitation to the overall JSON request itself. Any limitation would be set by the server parsing the JSON request. (For instance, ASP.NET has the "MaxJsonLength" property of the serializer.)


Please refer the Below Link:
asp.net mvc 4 - JSON data size limit - Stack Overflow[^]
 
Share this answer
 
MaxJsonLength: This helps to get or set the maximum JSON content length that you will send. The default value for this is 2097152 characters, that is equal to 4 MB of Unicode string data. You can even increase the size based if needed, for that you will get an idea later in this article

solutions:
protected override JsonResult Json(object data, string contentType,
Encoding contentEncoding, JsonRequestBehavior behavior)
{
return new JsonResult()
{
Data = data,
ContentType = contentType,
ContentEncoding = contentEncoding,
JsonRequestBehavior = behavior,
MaxJsonLength = Int32.MaxValue
};
}
 
Share this answer
 
This is confusing I have a nomal ajax call that work fine with 110 records but when I add more that this number I get sy
ntaxerror unexpected token in json at position 0
 
Share this answer
 
Comments
Member 9961992 3-May-18 8:35am    
This is confusing I have a nomal ajax call that work fine with 110 records but when I add more that this number I get sy
ntaxerror unexpected token in json at position 0
Richard MacCutchan 3-May-18 10:13am    
That means there is something wrong with your JSON data.
Afzaal Ahmad Zeeshan 3-May-18 19:54pm    
The problem is with your JSON data itself, and neither with the JSON size in the HTTP request, nor with this question.

Also, do not post questions as solutions — you are welcome to create a new thread and ask the question over there. :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900