UNPKG

jsonfieldexplorer

Version:

Node.js tool to efficiently explore and list all field paths in a JSON object. Perfect for understanding complex JSON structures, it recursively analyzes JSON data to provide a clear summary of nested fields and arrays.

13 lines (11 loc) 291 B
import fs from "fs"; export function readFile(filePath) { try { const data = fs.readFileSync(filePath, "utf8"); const json = JSON.parse(data); return json; } catch (error) { console.error("Error reading or parsing JSON file:", error.message); process.exit(1); } }