post方法中的JSON大小是否有限制? [英] Is there any limit for JSON size in post method?

查看:835
本文介绍了post方法中的JSON大小是否有限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

post方法中JSON大小是否有限制?

我没有从任何网站得到正确答案。:(



根据下面的网站,默认限制为8K,最大值为2MB是正确的吗?



[ Json Limit ]



我想我们可以使用< requestlimits maxallowedcontentlength =10000>来设置wcf服务中输入json的限制。



那么有没有限制对于服务中的JSON数据?



我尝试过:



我试图在不同的网站找到答案,但它的混乱ng。

如下图所示,Json没有限制

http://stackoverflow.com/questions/1262376/is-there-a-limit-on -how-much-json-can-hold



但是在其他一些网站上他们说默认限制是8k(8000个字符),最大是2MB?

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 ?

推荐答案

JSON没有限制,但限制在于存储数据所涉及的数据存储。
There is no limit on JSON but the limitation is down to the data stores involved where you store the data.


Hello,

JSON数据没有限制。

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.)





请参考以下链接:

asp.net mvc 4 - JSON数据大小限制 - 堆栈溢出 [ ^ ]


MaxJsonLength:这有助于获取或设置您要发送的最大JSON内容长度。默认值为2097152个字符,等于4 MB的Unicode字符串数据。您甚至可以根据需要增加尺寸,因为您将在本文后面得到一个想法



解决方案:

protected override JsonResult Json(对象数据,字符串contentType,

编码contentEncoding,JsonRequestBehavior行为)

{

返回新的JsonResult()

{

数据=数据,

ContentType = contentType,

ContentEncoding = contentEncoding,

JsonRequestBehavior = behavior ,

MaxJsonLength = Int32.MaxValue

};

}
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
};
}


这篇关于post方法中的JSON大小是否有限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆