简体   繁体   English

JavaScript 的 JSON.Parse() 函数是否对它接受的参数有最大字符串长度限制?

[英]Does JavaScript's JSON.Parse() function have a max string length limit for the parameter it accepts?

Does JavaScript's JSON.Parse() have a max string length limit for the parameter it accepts? JavaScript 的JSON.Parse()是否对其接受的参数有最大字符串长度限制? If I pass a string to JSON.Parse() that exceeds the specific length, will it through an exception or decline from returning a valid value?如果我向JSON.Parse()传递超过特定长度的字符串,它会通过异常还是拒绝返回有效值?

Please provide an answer supported from valid resources.请提供有效资源支持的答案。 Thanks in advance.提前致谢。

There's no inherant size limits on JSON, but there can be limitations set by the browser or the server sending / handling related requests. JSON 没有固有的大小限制,但浏览器或服务器发送/处理相关请求可能会设置限制。 For example, ASP.net has JavaScriptSerializer.MaxJsonLength which can limit the length (defaults to 2097152 )例如,ASP.net 有JavaScriptSerializer.MaxJsonLength可以限制长度(默认为2097152

This takes an 32-bit interger, and so is limited to 2147483644 characters这需要一个 32 位整数,因此限制为2147483644 个字符

Int32整数 32

The maximum length of JSON strings. JSON 字符串的最大长度。 The default is 2097152 characters, which is equivalent to 4 MB of Unicode string data.默认为 2097152 个字符,相当于 4 MB 的 Unicode 字符串数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM