1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# ReparoJSON
A simple command-line tool to "repair" JSON. It only fixes the syntactic errors and never formats the given input.
## Usage
```
Usage: reparojson [OPTIONS] [FILE]
Arguments:
[FILE] The input JSON file (default: STDIN)
Options:
-q, --quiet Successfully exit if the input JSON is repaired
-h, --help Print help
-V, --version Print version
```
## Examples
```
$ echo '[ 1 2 ]' | reparojson
[ 1, 2 ]
$ echo '[ 1, 2, ]' | reparojson
[ 1, 2 ]
$ echo '{ "foo": 1 "bar": 2 }' | reparojson
{ "foo": 1 ,"bar": 2 }
$ echo '{ "foo": 1, "bar": 2, }' | reparojson
{ "foo": 1, "bar": 2 }
```
## Editor Integration Examples
### Neovim + nvim-lspconfig + efm-langserver
```lua
local lspconfig = require('lspconfig')
lspconfig.efm.setup({
init_options = { documentFormatting = true },
settings = {
rootMarkers = {".git/"},
languages = {
json = {
{
formatCommand = "reparojson -q",
formatStdin = true,
},
},
},
}
})
```
## License
See [LICENSE](./LICENSE).
|