Live data from Hacker News

Fx – Terminal JSON Viewer

fx.wtf

21–30 of 80 posts

Re: Fx – Terminal JSON Viewer

#22
post #2

Hey HN friends! I've taken `fx` back to the drawing board and completely rewritten it from the ground up. Excited to share what's new: 1. *Going Big*: `fx` now gracefully handles even the most massive JSON files. 2. *A New TUI Look*: Dive deep into your data with a revamped terminal interface—now with themes! 3. *Swift Navigation with Dig Fuzzy Search*: Feeling lost in JSON? Just type `.` and navigate with ease. 4. *…

I am probably missing something but is interactive mode not a flag? Is it just what happens with a longer JSON automatically?

Re: Fx – Terminal JSON Viewer

#24
post #15

Earlier quoted context omitted.

Not OP but echo '{"name": "world"}' | fx 'x => x.name' 'x => `Hello, ${x}!`' Is immediately grokkable compared to jq's syntax. I love jq, I think it's extremely powerful, but I have to load up the documentation in a side window every time I have use it.

Equivalent jq seems okay here: echo '{"name": "world"}' | jq '"Hello \(.name)"'

Yes and both can be expressed in js and jq. Poinjt is what JS is known by much more peopel. As fx uses Node or Deno we for example can use lodash in fx:

    fx '_.groupBy("commit.author.name")' '_.mapValues(size)'
       '_.toPairs' '_.sortBy(1)' '_.reverse' '_.take(10)' '_.fromPairs'
To do if in jq, it will take me much more time and extensive documentation reading.

Re: Fx – Terminal JSON Viewer

#25
post #2

Hey HN friends! I've taken `fx` back to the drawing board and completely rewritten it from the ground up. Excited to share what's new: 1. *Going Big*: `fx` now gracefully handles even the most massive JSON files. 2. *A New TUI Look*: Dive deep into your data with a revamped terminal interface—now with themes! 3. *Swift Navigation with Dig Fuzzy Search*: Feeling lost in JSON? Just type `.` and navigate with ease. 4. *…

Hello, Is there a commonly-used grammar for "json with comments and trailing commas" or does everyone just try to copy the jsonc from vscode?

It's basically https://json5.org/

CUE will happily take your JSON with comments and extra commas, or no commas too (lists still need them), most keys can be unquoted, and it's just a one-liner to get valid json or yaml from it

Re: Fx – Terminal JSON Viewer

#26
post #19

> Built using the Go programming language for efficient performance. Do you mean to say "efficiency" or "performance"? I dont see both working like that

It's correct as it is. Performance can be good or bad. "...for efficiency" would be correct, but if they were to write only "...for performance" it would missing a qualifier.

Re: Fx – Terminal JSON Viewer

#28
post #10

Having used https://jqlang.github.io/jq/ , wondering your pitch on advantages, alternative use cases for using fx?

I know JavaScript, so I immediately know a lot of the `fx` syntax.

I always found the `jq` syntax required many round-trips to the mail and more trial and error to get the syntax right.

Re: Fx – Terminal JSON Viewer

#29

it is written in Go. What does it have to do with npx/npm at all? Did I miss something about these tools?

Where do you see npm/npx mentioned?

The project supports JS scripts as arguments to process the data:

https://fx.wtf/getting-started#json-processing

It's hard to tell from the docs if there is any JS involved if you just pipe JSON data to fx. I would hope not, since it mentions being written in Go for performance.

Re: Fx – Terminal JSON Viewer

#30

Earlier quoted context omitted.

Where do you see npm/npx mentioned?

at https://fx.wtf/getting-started it says: $ cat file.json | npx fx .field

It seems it would work since they release an npm package too: https://www.npmjs.com/package/fx

A bit surprising, I wonder if they implemented it in JS too, or somehow managed to distribute their Go program on npm.

Edit: They indeed have a separate non-interactive version in JS: https://github.com/antonmedv/fx/tree/master/npm

Post reply on HN