admin管理员组文章数量:1312811
I'm using JSON.stringify(myString)
in Mozilla Firefox to convert a JavaScript object to a JSON string.
This function is working very well, but myString
is very large, and I have got an exception in Developer's Console:
The string you are trying to view is too long to be displayed by the Web Console.
And I can't fully copy json string.
I was trying to output this string in alert, but it has limit too. If there is any work-around how to solve it ?
I'm using JSON.stringify(myString)
in Mozilla Firefox to convert a JavaScript object to a JSON string.
This function is working very well, but myString
is very large, and I have got an exception in Developer's Console:
The string you are trying to view is too long to be displayed by the Web Console.
And I can't fully copy json string.
I was trying to output this string in alert, but it has limit too. If there is any work-around how to solve it ?
Share Improve this question edited Nov 4, 2016 at 15:40 TimoStaudinger 42.5k16 gold badges89 silver badges96 bronze badges asked Nov 4, 2016 at 15:37 VLeonovsVLeonovs 2,2515 gold badges26 silver badges46 bronze badges 7-
2
Just curious:
console.log(myString.length)
shows what? – Washington Guedes Commented Nov 4, 2016 at 15:39 - If it's just to copy, create a div and do innerHTML = myString. – AMagyar Commented Nov 4, 2016 at 15:40
- Why do you want to copy/log the string? – Felix Kling Commented Nov 4, 2016 at 15:42
- @FelixKling Why does it matter why he wants to copy the string? – user47589 Commented Nov 4, 2016 at 15:42
-
2
copy(JSON.stringify(...))
stores the result ofJSON.stringify()
in the clipboard – Andreas Commented Nov 4, 2016 at 15:52
2 Answers
Reset to default 11Firefox und Chrome provide some helpers available in the console.
One of these helpers is copy()
Firefox:
copy(object)
New in Firefox 38. Copy the argument to the clipboard. If the argument is a string, it's copied as-is. If the argument is a DOM node, its outerHTML is copied. Otherwise, JSON.stringify will be called on the argument, and the result will be copied to the clipboard.
Chrome:
copy(object)
copies a string representation of the specified object to the clipboard.
For Firefox it would be:
copy(yourObject)
You could log it to localStorage:
localStorage.setItem('JSON String', JSON.stringify(yourObject));
本文标签: javascriptString is not displayed by the Web Console because of sizeStack Overflow
版权声明:本文标题:javascript - String is not displayed by the Web Console because of size - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741887558a2403111.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论