jJsonViewer
is a jquery plugin which you can call on any jquery element. This function takes JSON
or stringified JSON
as input which will be converted into html and added into given element.
How to use -
- Just download jJsonViewer plugin. You only need javascript and stylesheet.
- Include both in your html page.
- Now call jJsonViewer on any element and pass it a json data
$(element).jJsonViewer(json)
1 2 3 |
|
Demo -
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
Output-
Enjoy collapsing and expanding over each JSON object and array. :)
Collapsed tree -
If you want the json tree to be collapsed by default, you can do so by providing `expanded: false’ option.
1
|
|
Demos-
1. Expanded Json Tree
2. Collapsed Json Tree