Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support line-delimited JSON #59

Open
dhirschfeld opened this issue Jun 20, 2022 · 2 comments
Open

Support line-delimited JSON #59

dhirschfeld opened this issue Jun 20, 2022 · 2 comments

Comments

@dhirschfeld
Copy link

I have a log file where each line is a JSON record. It would be handy to be able to use rich to pretty-print the log file to make it more easily human-parseable from the command line.

@harkabeeparolus
Copy link

Not all JSON tools can handle JSON Lines. I agree that this could be a nice feature to add!

As a workaround, you can convert the file from JSON Lines to a regular JSON array with jq, and then pipe it to rich:
cat foo.jsonl | jq -s | rich --json -

Of course, if you already have jq installed, it will also pretty-print your JSON Lines data directly... 😊
jq < foo.jsonl

@dhirschfeld
Copy link
Author

I think I didn't have jq installed so reached for what was available... and I wanted to try out rich-cli! 😀

In the intervening months I've gotten a lot more familiar with jq so would probably use that for the job. It might still be nice if it were supported by rich but probably not a very high priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants