https://github.com/bayashi/go-jl
`go-jl` provides recursive JSON decorder to show the "JSON within JSON" log nicely
https://github.com/bayashi/go-jl
cli command-line-tool golang json log logging tool viewer
Last synced: 10 months ago
JSON representation
`go-jl` provides recursive JSON decorder to show the "JSON within JSON" log nicely
- Host: GitHub
- URL: https://github.com/bayashi/go-jl
- Owner: bayashi
- License: mit
- Created: 2023-05-03T12:41:02.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-01T06:47:44.000Z (about 1 year ago)
- Last Synced: 2025-04-07T07:24:39.998Z (about 1 year ago)
- Topics: cli, command-line-tool, golang, json, log, logging, tool, viewer
- Language: Go
- Homepage:
- Size: 80.1 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-jl
Show the "JSON within JSON" log nicely
## Usage
`jl` command recursively converts JSON within JSON into one JSON structure.
Simple case:
```
$ cat simple.json
{
"foo": "{\"bar\":\"{\\\"baz\\\":123}\"}"
}
$ cat simple.json | jl
{
"foo": {
"bar": {
"baz": 123
}
}
}
```
Most use cases:
```
$ cat log.json
{
"message": "{\"level\":\"info\",\"ts\":1557004280.5372975,\"caller\":\"zap/server_interceptors.go:40\",\"msg\":\"finished unary call with code OK\",\"grpc.start_time\":\"2019-05-04T21:11:20Z\",\"system\":\"grpc\",\"span.kind\":\"server\",\"grpc.service\":\"FooService\",\"grpc.method\":\"GetBar\",\"grpc.code\":\"OK\",\"grpc.time_ms\":248.45199584960938}\n",
"namespace": "foo-service",
"podName": "foo-86495899d8-m2vfl",
"containerName": "foo-service"
}
$ cat log.json | jl
{
"containerName": "foo-service",
"message": {
"caller": "zap/server_interceptors.go:40",
"grpc.code": "OK",
"grpc.method": "GetBar",
"grpc.service": "FooService",
"grpc.start_time": "2019-05-04T21:11:20Z",
"grpc.time_ms": 248.45199584960938,
"level": "info",
"msg": "finished unary call with code OK",
"span.kind": "server",
"system": "grpc",
"ts": 1557004280.5372975
},
"namespace": "foo-service",
"podName": "foo-86495899d8-m2vfl"
}
```
Full options:
```
Options:
-h, --help Display help (This message) and exit
-P, --no-prettify Not prettify the JSON. Prettified by default
-e, --show-error Set this option to show errors, muted by default
--skip int Skip to parse JSON if the length of the source JSON less than this
-n, --split-lf Split line-feed \n in each element
-t, --split-tab Split tabs in each element
-v, --version Display version and build info and exit
```
## Installation
### homebrew install
If you are using Mac:
```cmd
brew tap bayashi/tap
brew install bayashi/tap/go-jl
```
### binary install
Download binary from here: https://github.com/bayashi/go-jl/releases
### go install
If you have golang envvironment:
```cmd
go install github.com/bayashi/go-jl/cmd/jl@latest
```
## License
MIT License
## Author
Dai Okabayashi: https://github.com/bayashi
