Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
738 views
in Technique[技术] by (71.8m points)

limit - json.stringify output is 1023 character...why ?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...