load-json-file

WebJar for load-json-file

License

License

MIT
Categories

Categories

JSON Data
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

load-json-file
Last Version

Last Version

5.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

load-json-file
WebJar for load-json-file
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/sindresorhus/load-json-file

Download load-json-file

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/load-json-file/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>load-json-file</artifactId>
    <version>5.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/load-json-file/
implementation 'org.webjars.npm:load-json-file:5.3.0'
// https://jarcasting.com/artifacts/org.webjars.npm/load-json-file/
implementation ("org.webjars.npm:load-json-file:5.3.0")
'org.webjars.npm:load-json-file:jar:5.3.0'
<dependency org="org.webjars.npm" name="load-json-file" rev="5.3.0">
  <artifact name="load-json-file" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='load-json-file', version='5.3.0')
)
libraryDependencies += "org.webjars.npm" % "load-json-file" % "5.3.0"
[org.webjars.npm/load-json-file "5.3.0"]

Dependencies

compile (5)

Group / Artifact Type Version
org.webjars.npm : pify jar [4.0.1,5)
org.webjars.npm : type-fest jar [0.3.0,0.4)
org.webjars.npm : parse-json jar [4.0.0,5)
org.webjars.npm : graceful-fs jar [4.1.15,5)
org.webjars.npm : strip-bom jar [3.0.0,4)

Project Modules

There are no modules declared in this project.

load-json-file

Read and parse a JSON file

Strips UTF-8 BOM, uses graceful-fs, and throws more helpful JSON errors.

Install

$ npm install load-json-file

Usage

const loadJsonFile = require('load-json-file');

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

API

loadJsonFile(filePath, options?)

Returns a Promise<unknown> with the parsed JSON.

loadJsonFile.sync(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

Versions

Version
5.3.0
4.0.0
2.0.0
1.1.0