Live data from Hacker News

Show HN: JSON Pizza – Beautify your JSON quickly

json.pizza

41–50 of 81 posts

Re: Show HN: JSON Pizza – Beautify your JSON quickly

#41
post #36

Earlier quoted context omitted.

It can also happen you don’t care about the data you are sharing. Why not using an online then?

Still too dangerous, and I don't trust new developers to make that determination. Once you get into the habit of pasting development details into random website textboxes hosted who-knows-where with who-knows-what ad networks, you're one keystroke away from leaking sensitive details that are correlated to your employer's IP range. Or maybe I'm a crank and need to lighten up. That's why I'm asking.

Hum. I can see both cases. I would also think even if they copy/paste sensitive information. Like SSNs or password. It will be so diluted in the noise of other people data that it won't matter. Most of these websites - I made one myself - are run by people like us and we won't care about what it sent to the server.

Re: Show HN: JSON Pizza – Beautify your JSON quickly

#43
post #6

Non web based approach using jq ( https://stedolan.github.io/jq/ ): json_source_on_stdout | jq .

I think it might be useful to note for other readers here that jq is very powerful for parsing json - you can programatically search, select, map, and mutate parts of any json. If you work with a lot of json, it's worth checking out.

Re: Show HN: JSON Pizza – Beautify your JSON quickly

#44
post #38
post #33

Earlier quoted context omitted.

Or cat foo.json | python3 -m json.tool Prettifying is also built in to python3 on any system.

useless use of cat: python3 -m json.tool foo.json

Usually though what happens is this:

    :) cat foo.json
    [oh crap]
    :) cat foo.json | python -m foo.tool
For the 2nd command I'd hit "[up] | pyth[tab] -m json.tool"

Re: Show HN: JSON Pizza – Beautify your JSON quickly

#45
post #39

OS X includes the json_pp command, so I often just do this to format JSON in my clipboard: pbpaste | json_pp | pbcopy For just viewing, I like Node's console.dir() formatting better since it's more compact and colored (but it's unquoted JS objects, not JSON), so I aliased this command in my shell: json='node -e '\''console.dir(JSON.parse(fs.readFileSync("/dev/stdin", "utf-8")), { depth: null })'\' Then I can do pbpas…

If you have `jq` installed then you can just pipe any JSON to `jq` and it will beautify and colorize it automatically. pbpaste | jq

+1 for JQ, I use it in just about any place I can

Re: Show HN: JSON Pizza – Beautify your JSON quickly

#46
Nice - i've been a long time fan of https://jsoneditoronline.org/ which has some nice sort/filter functions built in.

You can also just open chrome / firefox dev tools console and assign it to a variable...

Sadly, all of these tools fall over for very large json objects

Re: Show HN: JSON Pizza – Beautify your JSON quickly

#47
post #26
post #19

Not to threadcrap, but I am curious what people think about this. Over the years I've seen a lot of developers take none open-source code, or private JSON data strings and paste them into random sites they find searching "json format" on google. Does that make anyone else cringe? Is there anything we can do about this? Or is this just not a big deal and I shouldn't worry.

You can do the same in the browser console. I don't really get why people need an online tool for this: copy(JSON.stringify(obj, null, 2)) obj can be parsed with JSON.parse if it is in text.

Even better, just open the JSON file in Firefox.

Re: Show HN: JSON Pizza – Beautify your JSON quickly

#49
post #19

Not to threadcrap, but I am curious what people think about this. Over the years I've seen a lot of developers take none open-source code, or private JSON data strings and paste them into random sites they find searching "json format" on google. Does that make anyone else cringe? Is there anything we can do about this? Or is this just not a big deal and I shouldn't worry.

I've caught coworkers doing this with base64 for at least a decade before JSON was a thing. And keep in mind we base64 things like credentials, RSA keys...

There are some things you just shouldn't paste into the internet.

Post reply on HN