Skip to content
Escape nested double quotes and unescape apostrophes within JSON string.
Branch: master
Clone or download
Anatoliy Gatt
Anatoliy Gatt 2.0.0
Latest commit 9250054 Sep 7, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib 2.0.0 Sep 7, 2017
test Replace var with const Sep 7, 2017
.editorconfig Update .editorconfig May 6, 2016
.gitattributes Add .gitattributes Apr 5, 2016
.gitignore Update .gitignore Nov 4, 2016
.npmignore Add newline at the end of all text files Apr 5, 2016
.travis.yml Update node versions in .travis.yml Sep 7, 2017
CHANGELOG.md 2.0.0 Sep 7, 2017
LICENSE Update LICENSE Sep 4, 2017
README.md
index.js 2.0.0 Sep 7, 2017
package-lock.json 2.0.0 Sep 7, 2017
package.json 2.0.0 Sep 7, 2017

README.md

escape-json-node Logo

Escape nested double quotes and unescape apostrophes within JSON string.

NPM Package Version NPM Package License NPM Package Downloads devDependencies Status

Node Version Travis CI Build Status Code Climate Status Code Climate Test Coverage Status Inch CI Documentation Coverage Status Styled with Prettier

NPM Package Statistics

Installation

npm install escape-json-node

Usage Example

var escapeJSON = require('escape-json-node');

var JSONString = '{"quoteText": "\'Acceptance says, "True, this is ' +
'my situation at the moment. I\'ll look unblinkingly at the reality of it. ' +
'But I will also open my hands to accept willingly whatever a loving ' +
'Father sends me.""}';

JSONString = escapeJSON(JSONString);

console.log(JSONString);

{"quoteText": "'Acceptance says, \"True, this is my situation at the moment.
I'll look unblinkingly at the reality of it. But I will also open my
hands to accept willingly whatever a loving Father sends me.\""}

Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ npm test

License

Distributed under the MIT License.

You can’t perform that action at this time.