Getting started
Download the script and run it in Node.js 22 against a local JSON file. The result is a short description of the input shape.
node summary.mjs data.json Compatibility and review
Use the demo with synthetic inputs and review its behavior in your own tools before adapting it.
Resource files
Inspect the original contents and download individual files.
import { readFile } from "node:fs/promises";
const filename = process.argv[2];
if (!filename) {
console.error("Usage: node summary.mjs data.json");
process.exitCode = 1;
} else {
try {
const data = JSON.parse(await readFile(filename, "utf8"));
const type = Array.isArray(data) ? "array" : data === null ? "null" : typeof data;
const result = { type };
if (type === "array") result.length = data.length;
if (type === "object") result.keys = Object.keys(data);
console.log(JSON.stringify(result, null, 2));
} catch (error) {
console.error(error.message);
process.exitCode = 1;
}
}
JSON Summary Utility
Run with Node.js 22: node summary.mjs data.json. The script prints field names or the array length.
با Node.js 22 دستور را روی یک فایل محلی اجرا کن. ابزار نام فیلدها یا طول آرایه را چاپ میکند.
MIT · Betavan demo.
Raw Markdown
# JSON Summary Utility
Run with Node.js 22: node summary.mjs data.json. The script prints field names or the array length.
با Node.js 22 دستور را روی یک فایل محلی اجرا کن. ابزار نام فیلدها یا طول آرایه را چاپ میکند.
MIT · Betavan demo.