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.

Download file

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;
  }
}