json.stringify output is 1023 character…why ?

2019-02-23 12:07发布

i have a little big problem, my javascript object is too long, but it is ok. at the moment i use .stringify() function for convert my object in a json string, the string is truncated with "..." and the lenght is 1023.

why ? AND how change this limit ?

im sorry for my english.

1条回答
爷的心禁止访问
2楼-- · 2019-02-23 12:34

The RFC for JSON parsers (see http://www.ietf.org/rfc/rfc4627.txt section 4) says, each implementation may choose to limit the length and content of strings. So depending on which browser / version you are using at the moment, you may be hitting the limit.

One portable alternative would be to look at json2. The JS source is found at https://github.com/douglascrockford/JSON-js/blob/master/json2.js -- you could use this as-is, or alter it to deal with the length / type of data that's causing your problem.

查看更多
登录 后发表回答