ini-to-json-cli
v1.0.0
Published
Convert INI files to JSON and JSON to INI
Readme
ini-to-json-cli
Convert INI files to JSON and JSON to INI from the command line.
Installation
npm install -g ini-to-json-cliUsage
INI to JSON
# From file
ini-to-json-cli ini2json -i config.ini -o config.json
# From stdin
cat config.ini | ini-to-json-cli ini2json
# With custom indent
ini-to-json-cli ini2json -i config.ini --indent 4
# Compact output (no pretty printing)
ini-to-json-cli ini2json -i config.ini --no-prettyJSON to INI
# From file
ini-to-json-cli json2ini -i config.json -o config.ini
# From stdin
cat config.json | ini-to-json-cli json2ini
# To stdout
ini-to-json-cli json2ini -i config.jsonCommands
| Command | Description |
|------------|--------------------------|
| ini2json | Convert INI file to JSON |
| json2ini | Convert JSON file to INI |
Options
| Option | Description | Default |
|-------------------|------------------------------------|----------|
| -i, --input | Input file path | stdin |
| -o, --output | Output file path | stdout |
| --pretty | Pretty print JSON output | true |
| --no-pretty | Disable pretty printing | |
| --indent <size> | Indentation size for pretty print | 2 |
Examples
Given config.ini:
[database]
host=localhost
port=5432
name=mydb
[server]
port=3000
debug=true$ ini-to-json-cli ini2json -i config.ini
{
"database": {
"host": "localhost",
"port": "5432",
"name": "mydb"
},
"server": {
"port": "3000",
"debug": "true"
}
}License
MIT
