Skip to content

readJson<T>

Reads a JSON file and parses its contents into a JavaScript object of type T.

Import:

import { readJson } from '@mnaoumov/typescript-dev-toolkit/json';

Signature:

function readJson(path: string): Promise<T>

Parameters:

Parameter Type Description
path string The path to the JSON file.

Returns: Promise<T> — A Promise that resolves with the parsed JSON object of type T.