简体   繁体   English

JSON对象的可视化(关联数组)

[英]Visualizations of JSON objects (Associative Arrays)

I want to display JavaScript objects (JSON), or more generally associative arrays (hash, map). 我想显示JavaScript对象(JSON),或者更一般地说是关联数组(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. 我知道JIT - JavaScript InfoVis Toolkit - 是一个js库,可以显示JSON数据中的树( spacetree layout )图结构。

D3.js is another, it has tree layout js which can handle JSON data. D3.js是另一个,它有树布局js,可以处理JSON数据。 There's this StackOverflow Question . 这是StackOverflow 问题

I've never tried any of them. 我从未尝试过任何一种。

If this is for debugging from the backend I would highly recommend: 如果这是从后端调试我强烈建议:

JSON View Chrome Extension JSON查看Chrome扩展程序

If however this is for Javascript debugging: 但是,如果这是用于Javascript调试:

console.dir(myJSONObj);

console.dir works better for objs than console.log. console.dir比console.log更适合objs。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM