Synchronous version of readJsonFile. Reads and parses a JSON file.
readJsonFile
The expected type of the parsed JSON.
The absolute path of the JSON file to read.
An IOResult containing the parsed JSON object.
IOResult
readJsonFile for the async version.
1.8.4
interface Config { name: string; version: number }readJsonFileSync<Config>('/config.json') .inspect(config => console.log(config.name)); Copy
interface Config { name: string; version: number }readJsonFileSync<Config>('/config.json') .inspect(config => console.log(config.name));
Synchronous version of
readJsonFile. Reads and parses a JSON file.