Strip trailing comma from JSON files
npm install strip-json-trailing-commas


Strip trailing commas from JSON files.
``bash`
$ yarn add strip-json-trailing-commas
or
`bash`
$ npm i strip-json-trailing-commas
`ts
import stripJsonTrailingCommas from 'strip-json-trailing-commas';
console.log(stripJsonTrailingCommas({ "a": 1, }));
// -> { "a": 1 }
// with options
console.log(
stripJsonTrailingCommas({ "a": 1 , }, {`
stripWhitespace: false,
}),
);
// -> { "a": 1 }
stripJsonTrailingCommas(content, options?)
Type: string
Receive JSON string and return a string without trailing commas.
Type: object
#### stripWhitespace
- Type: booleantrue`
- Default:
Strip some whitespace between end of data and trailing commas.
MIT