如何复制console控制台输出的对象数组?

图片描述

想把控制台输出的对象数组copy到编辑器中,但是copy之后编辑器就变成了这样

<script type="text/javascript">
        var json = [Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object]0: Object1: Object2: Object3: Object4: Object5: Object6: Object7: Object8: Object9: Object10: Object11: Object12: Object13: Object14: Object15: Object16: Object17: Object18: Object19: Objectlength: 20__proto__: Array[0]
    </script>

有什么方法copy吗?

阅读 8.9k
1 个回答

先转成字符串

JSON.stringify(data)

后面就很简单了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏