I want to display JavaScript objects (JSON), or more generally associative arrays (hash, map). There is no problem with flat ones, these are simple tables. But it becomes problematic with arrays, and deeply nested objects.

Are there good libraries to visualize this? There are two options I see here

  1. Visualize as a nested table

    This here is good example, I like it a lot, but apparently no library structure

  2. An associative array is a tree, so maybe reduce the problem to visualizing a tree.

有帮助吗?

解决方案

I know theJIT - JavaScript InfoVis Toolkit - is a js library which can display tree (spacetree layout) graph structures from JSON data.

D3.js is another, it has tree layout js which can handle JSON data. There's this StackOverflow Question.

I've never tried any of them.

其他提示

If this is for debugging from the backend I would highly recommend:

JSON View Chrome Extension

If however this is for Javascript debugging:

console.dir(myJSONObj);

console.dir works better for objs than console.log.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top