【发布时间】:2012-10-08 15:48:40
【问题描述】:
如何将对象输出为带有格式的可读字符串(结构类似于<pre>)?
不可能有 jQuery。
使用console.log,我的对象看起来像这样。
Object
title: "Another sting"
type: "tree"
options: Object
paging: "20"
structuretype: "1"
columns: Object
...
description: "This is a string"
...
将其转换为结构化字符串的最佳方法是什么?
我的尝试:
我尝试使用stringify() 来获取 JSON 结构。然后我可以编写自己的解析器,但也许已经有任何实现了?
【问题讨论】:
-
您介意使用框架吗? api.jquery.com/jQuery.parseJSON
-
@CharliePrynn 他说,不可能有 jQuery。
标签: javascript json object