Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 1.17 KB

README.md

File metadata and controls

27 lines (18 loc) · 1.17 KB

lighterjson

Optimal JSON minifier

Command line usage

lighterjson [options] inputfile

Options

-p N Numeric precision (number of decimal places; can be negative)
-n   Process NDJSON/JSON Lines
-N   Process NDJSON, preserving empty lines
-q   Suppress output

Notes

LighterJSON minifies regular and newline-delimited JSON files in place. It removes all whitespace. It also converts all strings and numbers to their most compact representation.

If passed a directory, all .json files contained within will be processed recursively.

Numbers can be rounded to specific decimal places using the -p switch. Use negative numbers to represent places greater than ones.

JSON technically supports numbers of unlimited size, but due to implementation complexity, the supported exponent range is [-9223372036854775807, 9223372036854775807].

Files must be UTF-8. Not all cases of ill-formed files are currently handled. Make sure to backup before running.

It depends on standard POSIX headers, so it works best in POSIX-compliant operating systems. However, it can also be built for Windows by using a Cygwin-based toolchain.

Author

Aaron Kaluszka <[email protected]>