Live data from Hacker News

Fx – Terminal JSON Viewer

fx.wtf

71–80 of 80 posts

Re: Fx – Terminal JSON Viewer

#71

Earlier quoted context omitted.

I'm not sure what you mean about the schema / documents thing. Can you elaborate? I've not had problems "linking" (?) data and schemas. I'd guess the lack of documentation is more to blame here. CUE is most often used as a CLI, so no Go is needed, that's really for advanced cases. Being Go, you can compile to SO or WASM, so can use it from pretty much any language. The lack of LSP is being actively worked on right no…

In an XML document you can specify the XML schema location with `xsi:schemaLocation`. In a JSON document you can specify the JSON Schema location with `$schema`. In a Cue document how do you specify the location of the Cue schema? As far as I can tell you can't. And yes I am aware that the concept of a "document" and a "schema" are basically merged in Cue, but that doesn't mean I don't want to do this. > CUE is most…

> In a Cue document how do you specify the location of the Cue schema?

CUE has proper dependency management* so you specify the schema through dependencies and imports, like we do with most languages we use. JSON and Yaml are notable exceptions to this, and things like what XML and JSONNet do, referring to an http (or remote) location that may or may not serve the same content between requests, make for irreproducibility.

* or will soon, there will be an experimental version in the next cue release, and hof has had it for 2+ years now

Re: Fx – Terminal JSON Viewer

#72

FYI: .wtf top domain is blocked in HaGeZi's The World's Most Abused TLDs: https://raw.githubusercontent.com/hagezi/dns-blocklists/main... Might wanna change to something else.

Used to use HaGeZi's Blocklist but kept hitting false positives like this.

Re: Fx – Terminal JSON Viewer

#73

Earlier quoted context omitted.

In an XML document you can specify the XML schema location with `xsi:schemaLocation`. In a JSON document you can specify the JSON Schema location with `$schema`. In a Cue document how do you specify the location of the Cue schema? As far as I can tell you can't. And yes I am aware that the concept of a "document" and a "schema" are basically merged in Cue, but that doesn't mean I don't want to do this. > CUE is most…

> In a Cue document how do you specify the location of the Cue schema? CUE has proper dependency management* so you specify the schema through dependencies and imports, like we do with most languages we use. JSON and Yaml are notable exceptions to this, and things like what XML and JSONNet do, referring to an http (or remote) location that may or may not serve the same content between requests, make for irreproducibi…

> there will be an experimental version in the next cue release

Ah cool, I will check it out later then. Good to know people are working on the issue.

> CUE, running in the browser

No no. By "that" I mean "provide libraries for other languages that wrap it using WASM".

> I see you are not interested in CUE and the benefits it offers

That's a bad attitude. Would I have learnt how to use Cue and about these limitations because I wasn't interested? You just don't want to admit that these are valid concerns.

Subprocess.run is clearly not the ideal way to interface with a configuration language. You can do it if you have to. But you really shouldn't.

Imagine if the only JSON parser in the world was written in OCaml and every program that wanted to read JSON had to run some OCaml program to convert it into another format that they could load. Obviously not a good state of affairs.

Re: Fx – Terminal JSON Viewer

#74

Earlier quoted context omitted.

> In a Cue document how do you specify the location of the Cue schema? CUE has proper dependency management* so you specify the schema through dependencies and imports, like we do with most languages we use. JSON and Yaml are notable exceptions to this, and things like what XML and JSONNet do, referring to an http (or remote) location that may or may not serve the same content between requests, make for irreproducibi…

> there will be an experimental version in the next cue release Ah cool, I will check it out later then. Good to know people are working on the issue. > CUE, running in the browser No no. By "that" I mean "provide libraries for other languages that wrap it using WASM". > I see you are not interested in CUE and the benefits it offers That's a bad attitude. Would I have learnt how to use Cue and about these limitations…

> That's a bad attitude.

I think we were probably talking past each other, my bad for continuing it

> Subprocess.run is clearly not the ideal way to interface with a configuration language.

100% agreement, but still better than the alternatives we had for addressing a complex problem.

yea, the interfaces to other languages is part of building out that ecosystem. The language is still changing a bit, but should hopefully stabilize in 0.8 or 0.9 (0.7 is going to bring significant performance improvements)

Yaml is another interesting case where there is inconsistent support and different defaults, depending on the library or tool. Config glues our world together, it's a complex mess because of where it sits. Everything we have today is cobbled together. To me, CUE offers a really great theory and foundation if we want to do something about it as an industry. Lord knows we're all suffering in YamHell

> You just don't want to admit that these are valid concerns.

I have my complaints and frustrations for sure, and I have been direct with the CUE team (in private) about some of the more sensitive issues, there are some comments on github and in public-ish documents if you're interested, mostly around the module proposal, which is in much better shape than anything written. The YT recordings are where the latest can be learned

Re: Fx – Terminal JSON Viewer

#75
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?

http://hyperrealm.github.io/libconfig/ ?

Re: Fx – Terminal JSON Viewer

#76
post #56
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. *…

Some feedback: - Some indication of how far down you've scrolled would be useful for "situational awareness". Perhaps a percentage number in the status bar (like emacs/vim?) - I miss not having the Home/End keys bound to the goto top/bottom actions - The cursor behavior when pressing PageDn/PageUp throws me off. Emacs when pressing PageDn: Cursor ends up at the top of the window. Vim: Cursor stays at the current posi…

Thanks for the feedback. Will try to address it in future releases.

Yes pgdown behaviour need to be refactored. Home/end is easy to add.

> If you remove the alphabet key shortcuts you wouldn't need the (non-discoverable) dot. :)

I did not get this one.

Re: Fx – Terminal JSON Viewer

#77
post #69

visidata anyone?

This fx rewrite is very exciting. I'll have to try it. I thought of fx as a wrapper around jq, that allowed quick iteration over building jq scripts. Sort of an Ultimate Plumber [1] but only for jq. It looks like it is now more like a JavaScript processor plus an interactive viewer.

Someone mention Visidata[2]? VisiData is also a TUI that is great on tabular data, and it can work with json. If your JSON is mostly tabular in nature, Visidata does a great job at showing that data and allowing you to explore it. A lot of json I deal with is tabular-like data. There is a great tutorial [3], that can help you get your bearings with Visidata. Once you understand those basics you might want to look at this thread [4] for what commands you can use with json.

[1] Ultimate Plumber: https://github.com/akavel/up

[2] Visidata: https://github.com/saulpw/visidata

[3] "Intro to VisiData Tutorial": https://jsvine.github.io/intro-to-visidata/ by Jeremy Singer-Vine

[4] "Is it possible to "flatten" structured data (like JSON?)": https://github.com/saulpw/visidata/discussions/1605

Re: Fx – Terminal JSON Viewer

#78
post #75

Earlier quoted context omitted.

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?

http://hyperrealm.github.io/libconfig/ ?

This looks like an implementation of some totally different format. Additionally, the authors of that format chose not to specify some parts of its grammar.

Re: Fx – Terminal JSON Viewer

#79

Earlier quoted context omitted.

jq seems shorter but I don't see how it's more intuitive - ".name" is pretty basic jq syntax but how do I know \() is syntax for wrapping selectors within strings? I've used jq for many years and tbh I've never done string templating with it, so I would need to go digging in the docs. You can argue that's the case for any language, but it's the fundamental reason DSLs rarely capture the mainstream for on-the-fly util…

Maybe the person you replied to fixed a syntax error in an edit? The backticks are required, and are currently in their comment.

After looking more at fx that seems to be the case yes! It's 100% pure js syntax so shouldn't have any gotchas.

Re: Fx – Terminal JSON Viewer

#80
post #33

Earlier quoted context omitted.

What’s the original JSON? Happy to try and express this in jq

Looks like the GitHub API: https://docs.github.com/en/free-pro-team@latest/rest/commits... I'm looking forward to your jq version. I love jq and use it all the time, but for anything of that complexity, I'd probably just use Python.

If the task was the produce an object with the top 10 commiters with username as key and value number of commits maybe something liket this:

    group_by(.commit.author.name) | map({key: first.commit.author.name, value: length}) | sort_by(.value) | reverse[:10] | from_entries
Post reply on HN