A library for pretty-printing and minifying XML, JSON, CSS, and SQL strings. Version 0.40.0 is the latest stable release; no active development since 2016. Lightweight with zero dependencies, it provides simple functions for formatting and minifying common data formats. Unlike formatters specific to one format (e.g., js-beautify for JS/HTML/CSS), pretty-data handles multiple formats in a single package, but lacks tree-shaking and is not modular. ESM is not supported; only CommonJS.
npm install pretty-dataNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates pretty-printing and minifying XML, JSON, CSS, and SQL using the library's CommonJS interface.
Ensure to convert objects to JSON strings using JSON.stringify before passing to pd.json functions.
Use require('pretty-data') instead of import.Consider migrating to more actively maintained libraries like js-beautify for CSS/JSON or sql-formatter for SQL.
If key sorting is needed, sort keys manually before pretty-printing.
Use a dedicated SQL formatter like sql-formatter for complex queries.
Ensure const pd = require('pretty-data'); then use pd.json.prettyPrint.Convert object to string: pd.json.prettyPrint(JSON.stringify(obj)).
Check that the input is a valid string before calling prettyPrint or min.
Run npm install pretty-data, then use require('pretty-data').Add const pd = require('pretty-data'); at the top of the file.No dependency data recorded yet.