https://github.com/berkmann18/json-fixer
A JSON checker and fixer
https://github.com/berkmann18/json-fixer
checker fixer json linter parser
Last synced: 3 months ago
JSON representation
A JSON checker and fixer
- Host: GitHub
- URL: https://github.com/berkmann18/json-fixer
- Owner: Berkmann18
- License: mit
- Created: 2019-04-16T13:46:55.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-05-19T20:25:31.000Z (about 2 years ago)
- Last Synced: 2025-03-27T11:51:22.804Z (4 months ago)
- Topics: checker, fixer, json, linter, parser
- Language: JavaScript
- Homepage:
- Size: 1.46 MB
- Stars: 14
- Watchers: 2
- Forks: 6
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
- [json-fixer](#json-fixer)
- [Usage](#usage)
- [Contributors β¨](#contributors-)# json-fixer
[](https://nodei.co/npm/json-fixer/)
[](https://github.com/Berkmann18/json-fixer)
[](https://david-dm.org/berkmann18/json-fixer?type=dev)
[](https://david-dm.org/berkmann18/json-fixer)[](https://github.com/Berkmann18/json-fixer/network/members)
[](https://github.com/Berkmann18/json-fixer/graphs/commit-activity)
[](https://github.com/Berkmann18/json-fixer/graphs/contributors)
[](https://github.com/Berkmann18/json-fixer/graphs/traffic)[](https://travis-ci.org/Berkmann18/json-fixer)
[](https://codecov.io/github/Berkmann18/json-fixer?branch=master)
[](https://github.com/facebook/jest)
[](https://snyk.io/test/github/Berkmann18/json-fixer?targetFile=package.json)[](https://github.com/Berkmann18/json-fixer/blob/master/LICENSE)
[](https://github.com/Berkmann18/json-fixer/issues)
[](http://commitizen.github.io/cz-cli/)[](https://github.com/Berkmann18/json-fixer)
[](https://github.com/Berkmann18/json-fixer)
[](https://github.com/Berkmann18/json-fixer)[](https://bettercodehub.com/results/Berkmann18/json-fixer)
[](https://app.codacy.com/manual/maxieberkmann/json-fixer?utm_source=github.com&utm_medium=referral&utm_content=Berkmann18/json-fixer&utm_campaign=Badge_Grade_Dashboard)A JSON file fixer primarly focused to be used in a NodeJS file.
## Usage
- In NodeJS
```js
const jsonFix = require('json-fixer')
const fs = require('fs')// Get the (potentially malformed) JSON data ready
const jsonContent = fs.readFileSync('config.json', 'utf-8')const {data, changed} = jsonFix(jsonContent) // Lint (and fix) it
if (changed) {
// Do something with `data` which is the fixed JSON parsed data from `jsonContent`
// e.g. `fs.writeFileSync(configPath, JSON.stringify(data, null, 2))`
}
```- In the CLI
_Not supported yet_ (PR welcome).## Contributors β¨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Maximilian Berkmann
π» π π€ π§ β οΈ π‘οΈ
Semantic Release Bot
π¦ π
all-contributors[bot]
π
Ben Kucera
π»
Svetozar Mateev
π π»
AndrΓ© Paulo
π
Erkin Matkaziev
π
Codacy Badger
π π
GiraffeKey
π» β οΈ
jonasmaertens
π
George Tsotsos
π»
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!