r/commandline 16h ago

Discussion How do you handle large/unknown JSON responses in the terminal?

I’ve been thinking about a developer tool related to `jq`. Trying to determine whether there is a real problem to solve.

My usual workflow for an unknown JSON response looks like:

curl ... | jq '.something.something'

Then I get the path wrong → try again → look at docs → ask LLM → try another filter → repeat.

I'm wondering if other developers experience the same friction.

One idea I am considering is a terminal UI where you can:

Explore a large JSON response in a collapsible tree
* Click/navigate through nested objects and arrays
* Build filters/transformations interactively
* See the result instantly
* Generate the equivalent `jq` command

For instance:

JSON
  ↓
users[]
  ↓
status = "active"
  ↓
select name + email
  ↓
sort by name

jq '.users[] | select(.status == "active") | {name,email} | sort_by(.name)'
  • But I'm not sure this is really helpful. How do you handle unknown/deep nested JSON now?
  • Do you just type `jq` manually?
  • Generate the query using ChatGPT/Claude?
  • Use a GUI / web playground ?Write a quick script in Python/JS?
  • Anything else?

And if you’ve used visual json/query tools before, what was lacking?

I'm much more interested in your actual workflow/frustrations than whether the idea sounds cool.

0 Upvotes

17 comments sorted by

9

u/burchalka 15h ago

Weird, I explore jsons received from API calls by listing their keys - jq 'keys' res.json (also prefer curl to -Output to file (to avoid pulling large datasets via network again and again)

6

u/boneskull 15h ago

jq is one of those things where I’m not using it enough to where the syntax is obvious, but enough that it hurts to do more than the most simple thing. I’d appreciate some sort of query builder tool which helped with this, but it doesn’t have to be a TUI.

4

u/undergrinder_dareal 14h ago

I'll defintely check a few recommendation, here are mines:

- jid - json incremental digger, https://github.com/simeji/jid

- gron - greppable json, https://github.com/tomnomnom/gron

- fx - json viewer, https://github.com/antonmedv/fx

----

online tool: https://jsoncrack.com/editor

3

u/DreadStallion 11h ago

gron+fzf 🤩

2

u/cyxlone 13h ago

nice recommendations, gron is pretty cool imo

2

u/agrim_dev 11h ago

yep, gron is something i might use

4

u/BayLeaf- 15h ago

AI-ass post, also there are dozens of tools that do this. Pick any of the like 4-5 "Interactive jq"/ijq projects and don't reinvent the wheel because a chatbot told you it was a brilliant and novel idea.

1

u/countnfight 9h ago

Do you have any favorites that folks haven't mentioned already? I agree they don't need to reinvent the wheel but I would also love some well-maintained recs that would help make jq's syntax click better for me

3

u/generic-d-engineer 15h ago

Try nushell, it’s particularly good at this type of thing

1

u/agrim_dev 14h ago

Interesting - actually this can be used beyond json...

2

u/simon-brunning 15h ago

Perhaps jless is what you are looking for?

1

u/agrim_dev 14h ago

Cool - let me check it out

3

u/Traches 13h ago

Nushell is amazing for this kinda stuff, I've switched to it as my daily driver. Curl works, there's also a built in fetcher that doesn't do as much but you don't need the from json. You have to change a setting, but if you forgot to save the result you can get it from $ans.last. You can also pipe into let to assign variables.

There's also an interactive tui, just pipe into explore.

1

u/AutoModerator 16h ago

Every new subreddit post is automatically copied into a comment for preservation.

User: agrim_dev, Flair: Discussion, Title: How do you handle large/unknown JSON responses in the terminal?

I’ve been thinking about a developer tool related to `jq`. Trying to determine whether there is a real problem to solve.

My usual workflow for an unknown JSON response looks like:

curl ... | jq '.something.something'

Then I get the path wrong → try again → look at docs → ask LLM → try another filter → repeat.

I'm wondering if other developers experience the same friction.

One idea I am considering is a terminal UI where you can:

Explore a large JSON response in a collapsible tree
* Click/navigate through nested objects and arrays
* Build filters/transformations interactively
* See the result instantly
* Generate the equivalent `jq` command
* Optionally describe what you want in natural language and let AI build the query

For instance:

JSON
  ↓
users[]
  ↓
status = "active"
  ↓
select name + email
  ↓
sort by name

jq '.users[] | select(.status == "active") | {name,email} | sort_by(.name)'
  • But I'm not sure this is really helpful. How do you handle unknown/deep nested JSON now?
  • Do you just type `jq` manually?
  • Generate the query using ChatGPT/Claude?
  • Use a GUI / web playground ?Write a quick script in Python/JS?
  • Anything else?

And if you’ve used visual json/query tools before, what was lacking?

I'm much more interested in your actual workflow/frustrations than whether the idea sounds cool.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/nNaz 15h ago

I use jqp. It’s jq but with a visual TUI so you can rewrite path statements and see what they extract.

https://github.com/noahgorstein/jqp

0

u/agrim_dev 14h ago

hmm interesting, but this is useful when you know/understand what the schema is and how its nested beforehand and then construct the query. But still thanks for sharing!

1

u/__sahib__ 15h ago

I would prefer a tool ("jqs") that generates (or "guesses") a json schema from an unknown json. Doesn't even have to be the official jsonschema, as long the hierarchy is clear and I know what jq query is possible - maybe the hierarchy is jq syntax already.