Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/miolini/jsonf
Console JSON formatter with query feature
https://github.com/miolini/jsonf
Last synced: about 1 month ago
JSON representation
Console JSON formatter with query feature
- Host: GitHub
- URL: https://github.com/miolini/jsonf
- Owner: miolini
- License: zlib
- Created: 2015-05-25T04:53:32.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-12-13T21:45:56.000Z (about 4 years ago)
- Last Synced: 2024-07-31T20:52:04.822Z (5 months ago)
- Language: Go
- Size: 79.1 KB
- Stars: 65
- Watchers: 5
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - jsonf - Console tool for highlighted formatting and struct query fetching JSON. (JSON / Search and Analytic Databases)
- awesome-go - jsonf - Console JSON formatter with query feature - ★ 53 (Utilities)
- awesome-go-extra - jsonf - 05-25T04:53:32Z|2020-12-13T21:45:56Z| (JSON / Advanced Console UIs)
README
Console JSON formatter with query feature.
Install:
```$ go get github.com/miolini/jsonf```
Usage:
```
Usage of jsonf:
-c=true: colorize output
-d=false: debug output to stderr
-f=true: format output json to stdout
-q="": json query
-s=true: syntax hightlight
-v=false: verbose output to stderr
```Examples:
```
$ echo '{"uid":1,"email":"[email protected]","address":{"city":"New-York","country":"US"}}' | jsonf
```
![Output](https://cdn.rawgit.com/miolini/jsonf/master/output.png "Output")
```
$ echo '{"uid":1,"email":"[email protected]","address":{"city":"New-York","country":"US"}}' \
| jsonf -q 'value["address"]["country"]'
``````
"US"
```## Using from another Golang program
```go
import (
...
"github.com/miolini/jsonf/jsonflib"
...
)
...
jsonRaw, err := jsonflib.Highlight(
jsonRaw,
jsonflib.HighlightFlags{Colorize: true, Verbose: false, Debug: false},
)
if err != nil {
return err
}
```