سؤال

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