npm install skincare-json
or
yarn add skincare-json
It does the cleaning treatment and the conversion of a JSON.
Turn this:
{
"whatever": ",
"whatever2": "easy "peasy" ""lemon squeezy"",
"whatever3": "\rwhata"",
}
Into this:
{
"whatever": "",
"whatever2": "easy peasy lemon squeezy,
"whatever3": "whata",
}
const skinJSON = require('skincare-json');
const jsonDirty = '{
"whatever": ",
"whatever2": "easy "peasy" ""lemon squeezy"",
"whatever3": "\rwhata"",
}'
try {
const jsonClean = JSON.parse(jsonDirty);
} catch (error) {
const jsonClean = skinJSON.parse(jsonDirty);
}
console.log(jsonClean);
- Gustavo Henrique - Gustavoohrq
This project is licensed under the GNU GPL V3 - see the LICENSE.md file for details