mirror of
https://github.com/Noratrieb/jsonformat.git
synced 2026-01-14 14:15:03 +01:00
cleanup
This commit is contained in:
parent
61e1e5d6fb
commit
28c691da5b
10 changed files with 11429 additions and 66 deletions
17
README.md
17
README.md
|
|
@ -2,11 +2,13 @@
|
|||
|
||||
`jsonformat` is an extremely fast JSON formatter.
|
||||
|
||||
It formats over 60MB of nested JSON in under 0.4s.
|
||||
It formats over 20MB of nested JSON in 60ms.
|
||||
|
||||
For the library, look at [docs.rs](https://docs.rs/jsonformat)
|
||||
|
||||
## Install
|
||||
You need Rust installed on your system
|
||||
`cargo install jsonformat`
|
||||
`cargo install jsonformat-cli`
|
||||
|
||||
## Usage
|
||||
```
|
||||
|
|
@ -28,13 +30,14 @@ OPTIONS:
|
|||
Reads from stdin if no file is supplied.
|
||||
Outputs to stdout if no output file is specified.
|
||||
|
||||
On windows, it writes to a file called `<filename>_f.json`, unless the `--stdout` flag is used or a custom output file is provided. This it to enable drag-and-drop in windows explorer.
|
||||
On Windows, it writes to a file called `<filename>_f.json`, unless the `--stdout` flag is used or a custom output
|
||||
file is provided. This it to enable drag-and-drop in Windows explorer.
|
||||
|
||||
## Error handling
|
||||
`jsonformat` does not report malformed json - it can't even fully know whether the json is actually malformed. Malformed json is just formatted kind of incorrectly, with no data lost and no crashes. If you find one, open an issue,
|
||||
`jsonformat` does not report malformed json - it can't even fully know whether the json is actually malformed.
|
||||
Malformed json is just formatted kind of incorrectly, with no data lost and no crashes. If you find one, open an issue,
|
||||
|
||||
|
||||
## How?
|
||||
`jsonformat` does not actually parse the json, it just loops through each character 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...
|
||||
`jsonformat` does not actually parse the json, it just loops through each character and keeps track of some flags.
|
||||
It then copies these characters to the output buffer, adding and removing whitespace.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue