load-object
v1.8.5
Published
Takes a path to a file locally or remotely and loads that file into a Javascript Object.
Downloads
54
Maintainers
Readme
load-object
load-object
is a useful node.js
utility package for loading data. load-object
loads data into a Javascript object from JSON, YAML, TOML, CBOR, Dhall, XML, HTML and Markdown both locally and remotely, thereby removing the need to manually pass the files to different parsers.
Issues:
- Dhall will probably only work on Linux and if you have dhall-to-json installed as it depends on native bindings. A resolution is planned for this by rewriting in
Purescript
.
Installation
npm install load-object
Usage
ES Modules
import { load } from "load-object"
Use Locally
// Should have one of these extensions: .json, .yaml, .yml, .dhall, .toml, .md, .cbor
const filePath = "./openapi.json"
const object = load(filePath)
Use Remotely
// Should have one of these extensions: .json, .yaml, .yml, .dhall, .toml, .md
const url = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.json"
const object = load(url)