json-multiline-strings
One shortcoming of JSON is the lack of multiline support. This module will split/join multiline strings to string arrays which is more readable.
EXAMPLE
Convert to multiline variant:
var input = console.log(JSON.stringify(jsonMultilineStrings.split(input), null, ' '))
Convert back to original json:
var input = console.log(JSON.stringify(jsonMultilineStrings.join(input), null, ' '))
API
jsonMultilineStrings.split(data, options) resp. jsonMultilineStringsSplit(data, options)
Processes input data recursively and convert all multiline strings to string arrays.
Options:
- exclude: Exclude the following paths from modifications. Give an array of string arrays, e.g. [ [ 'foo', 'bar' ], [ 'test' ] ]. This would not modify the paths 'foo/bar' and 'test'.
jsonMultilineStrings.join(data, options) resp. jsonMultilineStringsJoin(data, options)
Processes input data recursively and convert all string arrays to multiline strings.
Options:
- exclude: Exclude the following paths from modifications. Give an array of string arrays, e.g. [ [ 'foo', 'bar' ], [ 'test' ] ]. This would not modify the paths 'foo/bar' and 'test'.
INSTALL
JS usage via npm
npm install --save json-multiline-strings
var jsonMultilineStrings = jsonMultilineStringsjsonMultilineStrings
PHP usage via composer
composer install plepe/json-multiline-strings
jsonMultilineStringsSplit(...)jsonMultilineStringsJoin(...)
Development
git clone https://github.com/plepe/json-multiline-strings.gitcd json-multiline-stringsnpm installcomposer install