Catj

Dev tools

json cli viewer

SHOW HN2019

Legend

Catj

A new way to display JSON files

github.com

#json#jq#flatten json#json paths

388points
120comments
#62of 2,195 in 2019
Top 3%of 2019 by points

How HN took it

DebatedReal support and real criticism

10 positive, 14 neutral or asking, 1 mixed, 10 critical, out of 35 comments about the project. Thread score -0.03.

Idea: 9 for, 6 againstDesign: 0 for, 3 againstExecution: 0 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Useful for exploring JSON; clever flattening idea.

    From 3 comments
    • That's really smart, in fact this was - maybe until now - the only reason for me to resort to csv. (With pandas it's by the way really easy to flatten jsons into csv) JSON is…
      blablabla123 on HN
    • It looks almost executable! If it were, that might be handy now and then.
      etaioinshrdlu on HN
    • What a simple and clever idea. I would love something like that for XML in C#.
      htk on HN

Objections

  • The flat format is hard to read for large files and loses editor nesting help.

    From 2 comments
    • Oh no. This looks like the horrible config format a colleague of mine invented at Yahoo when making an absolutely horrific config system. This brings back bad memories. This may…
      bborud on HN
    • Please don't write JSON like the example - it's like putting 4 files in a hierarchy of 20 folders. Way over-structured. That said, if you're stuck dealing with bad JSON like this…
      QuadrupleA on HN
  • jq can already do this.

    From 3 comments
    • I was curious if this could be doable with jq, and apparently it is: ``` jq -j ' [ [ paths(scalars) | map( if type == "number" then "[" + tostring + "]" else "." + . end ) |…
      jolmg on HN
    • https://github.com/stedolan/jq/issues/243 jq can also do the same thing, with more flexibility. And it is possible to combine with bash alias to make it indistinguishable from catj
      flying_sheep on HN
    • cat foo.json | jq .
      hasahmed on HN

Requests

  • Option to disable colored output for piping.

    From 1 comment
    • I would recommend an optional flag to disable the output coloring, in the case where someone wants to pipe this to a file or other program.
      matmann2001 on HN

Questions

  • What is the use case?

    From 1 comment
    • Just curious, what would be the use case for something like this?
      BaconJuice on HN

Alternatives named

  • jq

    From 2 comments
    • I was curious if this could be doable with jq, and apparently it is: ``` jq -j ' [ [ paths(scalars) | map( if type == "number" then "[" + tostring + "]" else "." + . end ) |…
      jolmg on HN
    • https://github.com/stedolan/jq/issues/243 jq can also do the same thing, with more flexibility. And it is possible to combine with bash alias to make it indistinguishable from catj
      flying_sheep on HN
  • gron

    From 2 comments
    • Have you seen gron[0]? It's similar: flattens JSON documents to make them easily greppable. But it also can revert (ie, ungron) so you can pipe json to gron, grep -v to remove…
      avidal on HN
    • Looks a lot like ye olde gron: https://github.com/tomnomnom/gron Here's a Python implementation of gron https://github.com/venthur/python-gron
      venthur on HN
  • flatjson

    From 1 comment
    • I wrote a similar tool: https://github.com/twpayne/flatjson The flat format is great for diffs: ``` --- testdata/a.json +++ testdata/b.json @@ -1,5 +1,6 @@ root = {}; root.menu =…
      twp on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/20245913)