@jajaperson/js2json

1.0.6 • Public • Published

js2json NPM Version Build Status

Easily use JavaScript for configuration files to be converted to JSON.

Usage

First, install the package

Globally

npm install -g @jajaperson/js2json

Locally (recommended if you are using js2json in your build step)

npm install --save-dev @jajaperson/js2json

Then, run the command like so

js2json --input example.json.js

You can also use --output to specify the output path

js2json --input example.json.js --output my-new-json-file.json

Advanced options

$ js2json --help
--input <input file> [args]

Options:
  --version, -v   Show version number                                  [boolean]
  -i, --input     js file to convert                         [string] [required]
  -o, --output    json file to output           [string] [default: <input>.json]
  -p, --pretty    format the json output                               [boolean]
  --sp, --spaces  number of spaces to use for indentation  [number] [default: 2]
  --help, -h      Show help                                            [boolean]

Use Cases

If you want to include dynamic values in a JSON configuration file, you can use a javascript file that module.exports the object and add js2json to your build step.

Readme

Keywords

Package Sidebar

Install

npm i @jajaperson/js2json

Weekly Downloads

0

Version

1.0.6

License

MIT

Unpacked Size

5 kB

Total Files

6

Last publish

Collaborators

  • jajaperson