Live data from Hacker News

JSON Crack – Visualize JSON data into graphs

jsoncrack.com

91–100 of 100 posts

Re: JSON Crack – Visualize JSON data into graphs

#91
post #90

Earlier quoted context omitted.

Python formats it almost exactly like you did: $ python3 -m json.tool { "squadName": "Super hero squad", "homeTown": "Metro City", "formed": 2016, "secretBase": "Super tower", "active": true, "members": [ { "name": "Molecule Man", "age": 29, "secretIdentity": "Dan Jukes", "powers": [ "Radiation resistance", "Turning tiny", "Radiation blast" ] }, { "name": "Madame Uppercut", "age": 39, "secretIdentity": "Jane Wilson",…

I don't python, but this scheme missed the point. Keys are vertically aligned, but values are not. Some brackets are vertically aligned, other are not (you have to hunt for the starting square brackets). Bracket take up a whole line each wasting vertical space.

I see, thanks. For me, the point is just "indent successive objects" so it suffices - especially when I'm in a Python mindset and mentally filtering out brackets anyway. But I could understand why you prefer the formatting as you do.

Re: JSON Crack – Visualize JSON data into graphs

#92
post #38

Earlier quoted context omitted.

The point was that the keys and values are all aligned to the same minimal column numbers :) Both `json-mode` `json-reformat` don't seem to do that (and ideally I'd like something that'd work with Clojure/EDN code..)

gg=G in evil mode will do that.

Evil (Emacs 27.1) produced this:

  {
  "squadName": "Super hero squad",
  "homeTown": "Metro City",
  "formed": 2016,
  "secretBase": "Super tower",
  "active": true,
  "members": [
          {
          "name": "Molecule Man",
          "age": 29,
          "secretIdentity": "Dan Jukes",
          "powers": [
                 "Radiation resistance",
                 "Turning tiny",
                 "Radiation blast"
                 ]
          },
          {
          "name": "Madame Uppercut",
          "age": 39,
          "secretIdentity": "Jane Wilson",
          "powers": [
                 "Million tonne punch",
                 "Damage resistance",
                 "Superhuman reflexes"
                 ]
          },
          {
          "name": "Eternal Flame",
          "age": 1000000,
          "secretIdentity": "Unknown",
          "powers": [
                 "Immortality",
                 "Heat Immunity",
                 "Inferno",
                 "Teleportation",
                 "Interdimensional travel"
                 ]
              }
          ]
  }
Interestingly, the first-level items are not indented. Real VIM 8.1 produced the same format, but the first-level items _are_ indented.

Re: JSON Crack – Visualize JSON data into graphs

#94
post #90

Earlier quoted context omitted.

I don't python, but this scheme missed the point. Keys are vertically aligned, but values are not. Some brackets are vertically aligned, other are not (you have to hunt for the starting square brackets). Bracket take up a whole line each wasting vertical space.

I see, thanks. For me, the point is just "indent successive objects" so it suffices - especially when I'm in a Python mindset and mentally filtering out brackets anyway. But I could understand why you prefer the formatting as you do.

I think having the values aligned make it much quicker to read off entries. I will generally looked at the keys for the first entry, but for subsequent entries I assume the same ordering and just look at the values on the right.

It's a bit trivial, but another subtle effect that I like is that the sub-blocks are not mutually vertically aligned due to being offset by the semi-random length of the key

So for instance

    {"squadName":  "Super hero squad",
     "homeTown":   "Metro City",
     "formed":     2016,
     "secretBase": "Super tower",
     "active":     true,
     "members":    [{"name":           "Molecule Man",
                     "age":            29,
                     "secretIdentity": "Dan Jukes",
                     "powers":         ["Radiation resistance",
                                        "Turning tiny",
                                        "Radiation blast"]},
                    {"name":           "Madame Uppercut",
                     "age":            39,
                     "secretIdentity": "Jane Wilson",
                     "powers":         ["Million tonne punch",
                                        "Damage resistance",
                                        "Superhuman reflexes"]}],
    "enemies": [{"name":           "Eternal Flame",
                 "age":            1000000,
                 "secretIdentity": "Unknown",
                 "powers":         ["Immortality",
                                    "Heat Immunity",
                                    "Inferno",
                                    "Teleportation",
                                    "Interdimensional travel"]}]}
at a glance you see that the third person is not part of the same list as the first two

If all second level blocks are at the same level then you need to visually catch that there is extra key.

Re: JSON Crack – Visualize JSON data into graphs

#95
Looks like a cool project and I love that it is open source.

But naming a graph visualization tool using the same word as the Microsoft Flowchart visualization tool would make me somewhat nervous since it can cause "brand confusion." Granted I can't find a trademark listed for Visio specifically (maybe the name is too generic) so may be all good.

Re: JSON Crack – Visualize JSON data into graphs

#96
post #36

If you indent your code manually then you can achieve something that I feel looks quite similar. So the example they give would be written as: {"squadName": "Super hero squad", "homeTown": "Metro City", "formed": 2016, "secretBase": "Super tower", "active": true, "members": [{"name": "Molecule Man", "age": 29, "secretIdentity": "Dan Jukes", "powers": ["Radiation resistance", "Turning tiny", "Radiation blast"]}, {"nam…

If you climb to the top of a really tall mountain you'll get a similar perspective to what Google Maps provides.

I actually laughed.

Though - one does not have to do that stuff manually I can imagine some json linter could be configured to do such layout, or someone can just write tool to do that. So idea for this indentation is not bad IMHO.

Re: JSON Crack – Visualize JSON data into graphs

#99

this might be a good place to ask: is there any tool out there that can help with json to normalised tables? I know that many databases can store json, but i often have api's that i would like storing in tables, and feel that 'splitting it out' should be fairly trivial. Each time i think about making a tool, i am put off by the fact that there is a voice saying 'someone will have done this, in a much better way than…

If you have an MS office suite the power query editor can expand JSON to columns. Doesn't result in a table that is normalized per se, but it is quite a powerful tool overall. Not really a Microsoft fan, but what they provide here is not bad at all.

Re: JSON Crack – Visualize JSON data into graphs

#100
post #36

If you indent your code manually then you can achieve something that I feel looks quite similar. So the example they give would be written as: {"squadName": "Super hero squad", "homeTown": "Metro City", "formed": 2016, "secretBase": "Super tower", "active": true, "members": [{"name": "Molecule Man", "age": 29, "secretIdentity": "Dan Jukes", "powers": ["Radiation resistance", "Turning tiny", "Radiation blast"]}, {"nam…

You can even do this by console logging with JSON.stringify(): https://stackoverflow.com/questions/4810841/pretty-print-jso...
Post reply on HN