如何在<pre> tag

时间:2017-06-20 12:31:06

标签: javascript jquery

{ "data": [ { "id": "ABC1", "quantity": 10 } , { "id": "ABC2", "quantity": -10 } ] }

How can we collapse, if the Json structure is too long and expand it based on users wish in a page usin jquery!

2 个答案:

答案 0 :(得分:0)

You can use jQuery JSONView plugin.

Here is the demo.

答案 1 :(得分:0)

You can use any of the JQuery Plugins out there for "Pretty JSON tree viewers"

Below is the link to the first result on Google : http://www.jqueryscript.net/other/jQuery-Based-Pretty-Collapsible-JSON-Tree-Viewer.html