JsonToolkit.js: A Local-First JavaScript JSON Management Library
JsonToolkit.js is a lightweight ES6 JavaScript module with zero external dependencies, designed for formatting, validation, and exploration of JSON structures on the client side. It was engineered for local-first data processing focused on security, ensuring that data is never sent to external servers.
JSON Formatting, Validation & Minification
The core engine of JsonToolkit.js provides a versatile suite for handling raw JSON strings, powering the JSON Formatter & Validator tool:
- Validity Checking: Detects syntax errors, missing brackets, or invalid delimiters, returning detailed status errors and telemetry messages.
- Customizable Layout (Indentation & Minification): Allows configuring the indentation tab size to improve readability (beautification) or completely stripping unnecessary whitespace and line breaks for minification.
Interactive Structural Exploration (JSON Exploration)
For analyzing complex and deeply nested data, the library provides a decomposition mechanism that powers the JSON Explorer tool:
- Hierarchical Flattening: Parses the JSON tree and transforms nested objects and arrays into a structured list of nodes, facilitating navigation and filtering at the path level.
- Statistics & Analysis: Automatically computes essential metrics and structural info for input data, streamlining type and size verification.
Quick Start Example
Integration is straightforward and relies on standard ES6 native imports:
import JsonToolkit from "./JsonToolkit.js";
// 1. Format and validate raw JSON
const rawJson = '{"name":"nKode","active":true}';
const formatResult = JsonToolkit.format(rawJson, { tabSize: 4 });
if (formatResult.valid) {
console.log("Formatted JSON:\n", formatResult.output);
} else {
console.error("Validation failed:", formatResult.messages);
}
// 2. Explore and flatten JSON structure for node analysis
const complexJson = '{"user": {"id": 1, "roles": ["admin", "user"]}}';
const exploreResult = JsonToolkit.explore(complexJson);
console.log("Flattened Nodes:", exploreResult.nodes);
Availability & Open Source
The library is distributed under the GNU GPL v3.0 open-source license, following privacy-by-design principles. The source code is fully open and available for auditing, issue reporting, or contributions via the JsonToolkit GitHub Repository.
To test its functionality in practice, you can use the live Online Developer Tools provided by nKode.


