1.0.0 • Published 9 years ago

fix-newlines-in-json-strings v1.0.0

Weekly downloads
7
License
ISC
Repository
gitlab
Last release
9 years ago

fix-new-lines-in-json-strings

Description

Process a JSON string and converts actual newlines that appear in a string into an escaped newline.

Synopsis

var fixNewLinesInJsonStrings = require('fix-new-lines-in-json-strings');

var json = "{\
    "name": "Fred Blogs\
(snr)"\
}";

var fixedJson = fixNewLinesInJsonStrings(json);

var obj = JSON.parse(fixedJson);

console.log(obj);
1.0.0

9 years ago