mirror of
https://github.com/Noratrieb/jsonformat.git
synced 2026-01-16 15:15:01 +01:00
Compare commits
No commits in common. "master" and "v2.1.0" have entirely different histories.
3 changed files with 3 additions and 47 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -267,7 +267,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jsonformat-cli"
|
name = "jsonformat-cli"
|
||||||
version = "1.0.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap 3.2.25",
|
"clap 3.2.25",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "jsonformat-cli"
|
name = "jsonformat-cli"
|
||||||
version = "1.0.0"
|
version = "0.2.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
description = "Formats JSON extremely fast"
|
description = "Formats JSON extremely fast"
|
||||||
|
|
@ -14,7 +14,7 @@ categories = ["command-line-utilities"]
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
jsonformat = { path = "..", version = "2.1.0" }
|
jsonformat = { path = "..", version = "2.0.0" }
|
||||||
clap = { version = "3.1.12", features = ["derive"] }
|
clap = { version = "3.1.12", features = ["derive"] }
|
||||||
anyhow = "1.0.57"
|
anyhow = "1.0.57"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
# Extremely fast JSON formatter
|
|
||||||
|
|
||||||
`jsonformat` is an extremely fast JSON formatter.
|
|
||||||
|
|
||||||
It formats over 20MB of nested JSON in 60ms.
|
|
||||||
|
|
||||||
## Library crate
|
|
||||||
|
|
||||||
For the library crate, look at [docs.rs](https://docs.rs/jsonformat)
|
|
||||||
|
|
||||||
## Binary Install
|
|
||||||
You need Rust installed on your system
|
|
||||||
`cargo install jsonformat-cli`
|
|
||||||
|
|
||||||
## Binary Usage
|
|
||||||
```
|
|
||||||
jsonformat-cli 0.2.0
|
|
||||||
Formats JSON extremely fast
|
|
||||||
|
|
||||||
USAGE:
|
|
||||||
jsonformat [OPTIONS] [INPUT]
|
|
||||||
|
|
||||||
ARGS:
|
|
||||||
<INPUT> The input file
|
|
||||||
|
|
||||||
OPTIONS:
|
|
||||||
-h, --help Print help information
|
|
||||||
-i, --indentation <INDENTATION> The indentation, s will replaced by a space and t by a tab.
|
|
||||||
ss is the default
|
|
||||||
-o, --output <OUTPUT> The output file
|
|
||||||
-V, --version Print version information
|
|
||||||
```
|
|
||||||
|
|
||||||
Reads from stdin if no file is supplied.
|
|
||||||
Outputs to stdout if no output file is specified.
|
|
||||||
|
|
||||||
## 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,
|
|
||||||
|
|
||||||
|
|
||||||
## 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.
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue