From 60ddcb0bf943715e424d0668e9073bde9f45ae79 Mon Sep 17 00:00:00 2001 From: Nilstrieb Date: Sat, 17 Jul 2021 23:30:05 +0200 Subject: [PATCH] readme --- README.md | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dad71ef..71dbfab 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,32 @@ -Formats json. +# Extremely fast JSON formatter -Will maybe even be fast in the future, idk +`jsonformat` is an extremely fast JSON formatter. -would be amazing if it even works. +It formats over 60MB of nested JSON in under 0.4s. -note: does not actually parse the json to a parse tree or something, it just formats it \ No newline at end of file +## Install +Currently, you have to build and install it yourself. +`cargo build --release` +The executable can then be found in `target/release/jsonformat` + +## Usage +``` +USAGE: + jsonformat [OPTIONS] [input] + +ARGS: + The input file to format + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information + +OPTIONS: + -i, --indent Set the indentation used (\s for space, \t for tab) + -o, --output The output file for the formatted json +``` + +## How? +`jsonformat` does not actually parse the json, it just loops through each characters and keeps track of some flags. It then copies these characters to the output buffer, adding and removing whitespace. + +The code is currently a bit chaotic, but it works and is fast, so good enough for now. Maybe it could profit from SIMD in the future, but I have never used it and I don't know whether it would work. Maybe some day... \ No newline at end of file