load-json-file
Read and parse a JSON file
Last updated 3 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install load-json-file 
SYNC missed versions from official npm registry.

load-json-file

Read and parse a JSON file

It also strips UTF-8 BOM.

Install

$ npm install load-json-file

Usage

import {loadJsonFile} from 'load-json-file';

console.log(await loadJsonFile('foo.json'));
//=> {foo: true}

API

loadJsonFile(filePath, options?)

Returns a Promise<unknown> with the parsed JSON.

loadJsonFileSync(filepath, options?)

Returns the parsed JSON.

options

Type: object

beforeParse

Type: Function

Applies a function to the JSON string before parsing.

reviver

Type: Function

Prescribes how the value originally produced by parsing is transformed, before being returned. See the JSON.parse docs for more.

load-json-file for enterprise

Available as part of the Tidelift Subscription.

The maintainers of load-json-file and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

Related

Current Tags

  • 7.0.1                                ...           latest (3 years ago)

15 Versions

  • 7.0.1                                ...           3 years ago
  • 7.0.0                                ...           3 years ago
  • 6.2.0                                ...           5 years ago
  • 6.1.0                                ...           5 years ago
  • 6.0.0                                ...           6 years ago
  • 5.3.0                                ...           6 years ago
  • 5.2.0                                ...           6 years ago
  • 5.1.0                                ...           6 years ago
  • 5.0.0                                ...           7 years ago
  • 4.0.0                                ...           7 years ago
  • 3.0.0                                ...           7 years ago
  • 2.0.0                                ...           9 years ago
  • 1.1.0                                ...           9 years ago
  • 1.0.1                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (3)

Copyright 2013 - present © cnpmjs.org | Home |