pretty-formats JSON in a ways that improve list readability
[![npm][9]][7] [![agpl][2]][1]
This package pretty-formats JSON in a ways that improve list readability. Example,
``javascript
import stringify from './stringify-condense.js'
stringify([
['users', [
['user', ['fred', 1, '3928']],
['user', ['jane', 2, '9271']],
['user', ['joan', 3, '9917']]
]]
])
// [
// ["users", [
// ["user", ["fred", 1, "3928"]],
// ["user", ["jane", 2, "9271"]],
// ["user", ["joan", 3, "9917"]]
// ]]
// ]
`
JSON.stringify(data, null, 2) returns this verbosity. Complex list structures become un-practically readable and un-practical to compare with unit-tests.
`json``
[
[
"users",
[
[
"user",
[
"fred",
1,
"3928"
]
],
[
"user",
[
"jane",
2,
"9271"
]
],
[
"user",
[
"joan",
3,
"9917"
]
]
]
]
]
Lists have many benefits over objects including; They are parsed in more predictable ways across different languages and runtimes. They hold positional data. They are more compact. In cases that do not require map-like data, lists provide lookup access that is programmatically faster and easier.
This package uses regular-expressions to re-stringify data. Please report any edge-cases where results are found to be incorrect.
[1]: https://www.gnu.org/licenses/agpl.txt
[2]: https://img.shields.io/badge/License-AGPLv3-blue.svg
[9]: https://img.shields.io/npm/v/stringify-condense
[7]: https://www.npmjs.com/package/stringify-condense