Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

json-fixer

Berkmann18377.9kMIT1.6.15TypeScript support: definitely-typed

A JSON fixer

json, fix, lint, check

readme

json-fixer

NPM

GitHub package version devDependencies Status dependencies Status

GH Downloads GitHub commit activity the past year GitHub contributors Github search hit counter

Build Status codecov.io Code Coverage tested with jest Known Vulnerabilities

GitHub contributions welcome Commitizen friendly

GitHub top language GitHub language count GitHub code size in bytes

BCH compliance Codacy Badge

A JSON file fixer primarly focused to be used in a NodeJS file.

Usage

  • In NodeJS
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):


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 specification. Contributions of any kind welcome!

changelog

1.6.15 (2022-09-06)

Bug Fixes

  • upgrade @babel/runtime from 7.17.9 to 7.18.9 (85d95e5)

1.6.14 (2022-08-16)

Bug Fixes

  • upgrade @babel/runtime from 7.14.6 to 7.17.9 (18b13f3)

1.6.13 (2021-11-29)

Bug Fixes

  • upgrade chalk from 4.1.1 to 4.1.2 (2e67a23)

1.6.12 (2021-07-12)

Bug Fixes

  • upgrade @babel/runtime from 7.14.5 to 7.14.6 (daa5e08)

1.6.11 (2021-07-07)

Bug Fixes

  • upgrade @babel/runtime from 7.14.0 to 7.14.5 (319709b)

1.6.10 (2021-06-03)

Bug Fixes

  • upgrade @babel/runtime from 7.12.5 to 7.14.0 (dbfd063)

1.6.9 (2021-05-14)

Bug Fixes

  • upgrade chalk from 4.1.0 to 4.1.1 (549ea47)

1.6.8 (2020-11-25)

Bug Fixes

  • upgrade @babel/runtime from 7.12.1 to 7.12.5 (d77dc09)

1.6.7 (2020-11-08)

Bug Fixes

  • upgrade @babel/runtime from 7.12.0 to 7.12.1 (116409f)

1.6.6 (2020-11-07)

Bug Fixes

  • upgrade @babel/runtime from 7.11.2 to 7.12.0 (5949534)

1.6.5 (2020-10-08)

Bug Fixes

  • fixer: addressed DeepScan's issue (2c5868d)
  • fixer: removed futile LOC (56f23a1)
  • fixes special characters (4e804e5)

1.6.4 (2020-10-08)

Bug Fixes

  • upgrade @babel/runtime from 7.11.0 to 7.11.2 (73e644e)

1.6.3 (2020-08-26)

Bug Fixes

  • upgrade @babel/runtime from 7.10.5 to 7.11.0 (4cc9017)

1.6.2 (2020-08-26)

Bug Fixes

  • lockfile: security update (54c3bf0)
  • lockfile: vulnerability fix (4b501a8)

1.6.1 (2020-08-24)

Bug Fixes

  • upgrade @babel/runtime from 7.10.4 to 7.10.5 (cf9367b)

1.6.0 (2020-08-24)

Features

  • extra-brackets: fix extra brackets (6958b4b)

1.5.4 (2020-07-22)

Bug Fixes

  • upgrade @babel/runtime from 7.10.3 to 7.10.4 (11ec2a7)

1.5.3 (2020-07-11)

Bug Fixes

  • upgrade @babel/runtime from 7.10.2 to 7.10.3 (a643b9b)

1.5.2 (2020-07-01)

Bug Fixes

  • upgrade chalk from 4.0.0 to 4.1.0 (21f39eb)

1.5.1 (2020-06-27)

Bug Fixes

1.5.0 (2020-06-27)

Bug Fixes

  • fixer: fixing missing LHS quotes with 1-2 chars (e2f8b9d)
  • fixer: lint fix (bbf3ed9)
  • fixer: wrongly added missing quote (2ee5e4f), closes #31
  • index: not applying trailing-char fixes on LHS issues (253ebfc), closes #38
  • missing quote fixer failure (60a5fff)
  • security fix (067bd46)
  • lockfile: security fix (cade206)

Features

  • fixer: trailing char fixer simplification (5899676)

1.4.2 (2020-06-18)

Bug Fixes

1.4.2 (2020-06-17)

Bug Fixes

1.4.2 (2020-06-17)

Bug Fixes

1.4.3 (2020-06-17)

Bug Fixes

~1.4.2~ (2020-06-08)

Bug Fixes

1.4.2 (2020-06-07)

Bug Fixes

  • fixer: wrongly added missing quote (2ee5e4f), closes #31
  • lockfile: security fix (cade206)

1.4.1 (2020-04-04)

Bug Fixes

  • package: vulnerability fix (7914f15)

1.4.0 (2019-12-15)

Bug Fixes

  • fixer: improved trailing character fixer (d671f0c), closes #18
  • package-lock: vulnerability fix (a61b48a)
  • security: bumped outdated packages + fixed vulnerabilities (78bf487)

Features

  • added options object with parse option (#21) (22874df)

1.3.3 (2019-09-18)

Bug Fixes

  • fixer: improved trailing character fixer (d671f0c)

1.3.2 (2019-09-02)

Bug Fixes

  • security: vulnerability fix (8dc1f81)

Performance Improvements

  • package: reduce bundle size by 99.2% (#15) (f915ee9)

1.3.1 (2019-05-31)

Bug Fixes

  • security: security update (3083a68)

1.3.0 (2019-05-19)

Features

  • added concatenation support (730d813)
  • operations support + refactoring (191a6b0), closes #10
  • index: round fix + improved quote fixer (6ecb55e)

1.2.0 (2019-05-17)

Features

  • index: added comment removers (12bd10d)

1.1.0 (2019-05-17)

Features

  • index: added a square->curly brackets fixer (9017579)
  • added verbosity and LHS no quote support (5b1504f)

1.0.0 (2019-05-17)

Features

  • index: add a missing comma fixer (1f8a535)
  • index: add a missing quote fixer (bc53b96)
  • index: added a single->double quote fixer (b39844a)
  • index: added a trailing dot fixer (13f4931)
  • index: generalised trailing dot (280b845)