Parse a file with JavaScript runtime tooling.
Section: Validate JSON files
Validate with Node.js
bash
bash
node -e 'JSON.parse(require("fs").readFileSync("input.json", "utf8")); console.log("valid")'Explanation
Useful in JavaScript-heavy environments.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Validate JSON files
Raw newlines inside strings are invalid
Use `\n` rather than an actual line break inside a string literal.