
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
json-tree-visualizer
Advanced tools
Basic JSON tree visualizer that works in browser with graphviz (viz.js)
Simple/Basic library for visualizing JSON data structures as non interactive tree diagrams (SVG).
JSON -> DOT -> GraphViz (using viz.js)
Examples are in /docs/examples
Download json-tree-visualizer.js and include it in your HTML:
<script src="json-tree-visualizer.js"></script>
<div id="my-tree"></div>
<script>
JSONTreeVisualizer.createWidget('my-tree', {
initialJSON: {
name: "John Doe",
age: 30,
skills: ["JavaScript", "Python"]
}
});
</script>
That's it! You now have a fully interactive JSON tree visualizer.
Convert JSON data to Graphviz DOT format for custom rendering.
const dotString = JSONTreeVisualizer.convertToDot(
{
user: { name: "Alice", age: 28 },
active: true
},
{
maxDepth: 10,
maxArrayItems: 5,
colorScheme: 'vibrant',
nodeSpacing: 0.6,
rankSpacing: 1.2
}
);
Parameters:
jsonData (Object): The JSON data to convertoptions (Object, optional): Configuration optionsOptions:
maxDepth (number): Maximum depth to traverse (default: 10)maxArrayItems (number): Maximum array items to display (default: 5)colorScheme (string): Color scheme - 'default', 'minimal', 'vibrant' (default: 'default')nodeSpacing (number): Horizontal spacing between nodes (default: 0.6)rankSpacing (number): Vertical spacing between levels (default: 1.2)truncateStrings (number): String truncation length (default: 30)showArrayIndices (boolean): Show array indices as edge labels (default: true)Validate and parse JSON string with detailed error reporting.
const result = JSONTreeVisualizer.validateJSON('{"name": "John", "age": 30}');
if (result.valid) {
console.log("Parsed data:", result.data);
} else {
console.log("Error:", result.error);
console.log("Error type:", result.errorType);
}
Returns:
valid (boolean): Whether the JSON is validdata (Object): Parsed JSON data (if valid)error (string): Human-readable error message (if invalid)errorType (string): Error category - 'empty', 'invalid_root', 'parse_error'originalError (string): Original parser error messageCreate a complete interactive visualization widget.
const widget = JSONTreeVisualizer.createWidget('container-id', {
showInput: true, // Show JSON input panel
showControls: true, // Show control buttons
initialJSON: null, // Initial JSON data
colorScheme: 'default', // Color scheme
maxDepth: 10, // Maximum depth
maxArrayItems: 5 // Maximum array items
});
// Load new data
widget.loadJSON({ message: "Updated data!" });
// Export DOT format
const dotString = widget.exportDOT();
Widget Methods:
loadJSON(jsonData) - Load new JSON data into the widgetexportDOT() - Export current visualization as DOT format string<script> or as CommonJS (Node.js)<script src="https://unpkg.com/json-tree-visualizer/dist/json-tree-visualizer.min.js"></script>
<!-- or -->
<script src="https://cdn.jsdelivr.net/npm/json-tree-visualizer/dist/json-tree-visualizer.min.js"></script>
import JSONTreeVisualizer from 'json-tree-visualizer/dist/json-tree-visualizer.esm.js';
// Usage is identical to the classic API
const dot = JSONTreeVisualizer.convertToDot({ foo: 'bar' });
To use the SVG rendering feature, the library will automatically load viz.js from a CDN if needed. If you want to include it manually (for full control or offline usage):
<script src="https://unpkg.com/@viz-js/viz@3.2.4/lib/viz-standalone.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<title>JSON Tree Visualizer Demo</title>
</head>
<body>
<h1>My JSON Data</h1>
<div id="json-tree" style="height: 600px;"></div>
<script src="json-tree-visualizer.js"></script>
<script>
const myData = {
user: {
name: "Alice Johnson",
email: "alice@example.com",
preferences: {
theme: "dark",
notifications: true
}
},
lastLogin: "2024-01-15T10:30:00Z"
};
JSONTreeVisualizer.createWidget('json-tree', {
initialJSON: myData,
colorScheme: 'vibrant'
});
</script>
</body>
</html>
FAQs
Basic JSON tree visualizer that works in browser with graphviz (viz.js)
We found that json-tree-visualizer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.