Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty print JSON by default? #82

Closed
xarg opened this issue Oct 4, 2015 · 23 comments
Closed

Pretty print JSON by default? #82

xarg opened this issue Oct 4, 2015 · 23 comments

Comments

@xarg
Copy link

xarg commented Oct 4, 2015

More often then not I want to read the JSON inside the fields. And I'm not storing indentation to save space. Right now there is the Pretty Print JSON option, but I have to click it for every row/field and it changes the field which is rarely what I actually want to do.

One negative aspect of this could be: If the JSON field is pretty printed by default and it's not what you have in the DB it could create confusion. Since only whitespace changes, I wouldn't expect much confusion though. I would love an option to show JSON pretty-printed by default.

@jakob
Copy link
Owner

jakob commented Oct 7, 2015

It would probably make sense for the new jsonb data type, since that type doesn't store any formatting information anyway. The normal json type is basically just a text field, so I don't want to mess with formatting there; especially since formatting might hide issues like duplicate keys.

I'll look into it; long term I'd love to implement a full graphical JSON editor.

@visini
Copy link

visini commented Oct 12, 2015

I second this! We use jsonb extensively and it'd be a great feature to pretty-print all jsonb data

@vincent-dm
Copy link

I would also appreciate this option very much!

@pauldoerwald
Copy link

I would love a feature like this. I emailed Jakob about it yesterday and he referred me to this ticket, so I'm recording my thoughts here.

Rather than hovering over the cell to reveal formatted JSON content, I would rather be able to double-click the cell, or click on a tiny link inside the cell, to reveal a large enough overlay with the pretty JSON inside of it. I suppose the same mechanism could be used for other large or complex types (text, hstore?).

I think a JSON editor would be overkill. Neat, but probably unnecessary.

@dazzaji
Copy link

dazzaji commented Mar 31, 2016

FWIW, also looking into using Postico for deeper work with JSON. Would be great to see some more support for it.

@mviau123
Copy link

mviau123 commented May 6, 2016

Also want deeper JSONB viewer / editor right inside Postico, starting to use it about everywhere, so like "single field column" so a good JSONB view / editor in Postico would be Huge for me, thanks.

@pauldoerwald
Copy link

Actually, while we're at it, let's feature-creep this even more! :)

For those with the force-touch trackpad, a regular click has the current behaviour, but a force-click on a JSONB column opens up the viewer/editor in an overlay like you get when you force-click a word to get its definition. How cool would that be?

@simonlast
Copy link

+1 on this

@aconran
Copy link

aconran commented Aug 19, 2016

Would love to see this

@mviau123
Copy link

+2! Having to copy paste to Sublime to view fields. using PG as a document store hybrid system with jsonb field is imho up and growing as a "best of both worlds" solution.

@cwhatley
Copy link

I think the editor idea is great, but the core feature I'm interested in here is an option to have a readable JSON field that is pretty-printed by default.

@venkatd
Copy link

venkatd commented Oct 26, 2016

While more full featured support would be nice, a quick solution with a huge impact on my workflow would be: pretty printing JSON columns and allowing me to view that in a new window.

@schmitzdenis
Copy link

+1!

@sheharyarn
Copy link

sheharyarn commented Mar 22, 2019

Want to bump this again. Would love the pretty-print-by-default option since it'll make my life so much easier!

A quick search reveals that this is the 3rd (4th?) most requested feature/enhancement and the 5th most commented issue. So hoping bumping this would grab your attention @jakob!

image

@sheharyarn
Copy link

Back here after 10 months, still requesting this. I believe it should be pretty easy to do and shouldn't require a lot of effort for a basic implementation. You could use something like postgres' built-in jsonb_pretty function internally.

https://til.hashrocket.com/posts/87ac2dcf6d-pretty-printing-jsonb-rows-in-postgresql

@visini
Copy link

visini commented Jan 20, 2020

I was so excited after I got a notification, but, after 4 years, we‘re still here. One can still hope! Thank you for your work @jakob

@jakob
Copy link
Owner

jakob commented Jan 22, 2020

OK, so I tried just using the jsonb_pretty function for fields of type JSONB.

If you want to see what it looks like, you can download a build here: https://eggerapps-downloads.s3.eu-west-1.amazonaws.com/postico-5881.zip

While the result is obviously great for displaying JSON data in the sidebar, it's not-so-great when looking at the table view, because all you are going to see now is just some curly braces most of the time.

Look at the data column in the following screenshot:

Bildschirmfoto 2020-01-22 um 18 15 44

Here's a screenshot from Postico 1.5.10 for comparison:

Bildschirmfoto 2020-01-22 um 18 17 36

I think the best solution would be if Postico showed the formatted data in the sidebar, and the unformatted data in the table view. Unfortunately this is not possible with the current architecture, since the data displayed in the sidebar and in the table view is always identical. So fixing this is not an easy change, and I still need to think about this issue for a bit.

@sheharyarn
Copy link

Thank you for looking into this again @jakob! Personally I would prefer this if I had to choose between the two but I understand this isn't ideal and might actually be disliked by other users. But still hoping you figure this out! 🤞

In the meantime I'll use the new build you uploaded 😄

@visini
Copy link

visini commented Jan 22, 2020

If you want to see what it looks like, you can download a build here: https://eggerapps-downloads.s3.eu-west-1.amazonaws.com/postico-5881.zip

While the result is obviously great for displaying JSON data in the sidebar, it's not-so-great when looking at the table view, because all you are going to see now is just some curly braces most of the time.

While I agree with @sheharyarn it's not an ideal solution, I also prefer the jsonb_pretty approach. Thank you for your work @jakob, truly outstanding over the last years!

@martinjankoehler
Copy link
Collaborator

Hey folks,

we have been working on some improvements regarding Postico JSON,
summarized in this issue:
#570 (comment)

Any feedback or issues discovered are highly appreciated!

Best regards,
Martin

@martinjankoehler
Copy link
Collaborator

Postico 1.5.18 was released today (download) and contains some JSON fixes, including pretty-pretting of jsonb values.

@jakob
Copy link
Owner

jakob commented Aug 24, 2021

I'm closing this issue, since Postico now pretty-prints JSONB values automatically in the sidebar, and displays a minimized form in the table view.

The latest build of Postico 2 now additionally allows double clicking a JSON or JSONB cell to open a big popover. This is nice if you don't use the sidebar, or if you want to look at JSON data in the SQL Query view, where we don't yet have a sidebar.

(See https://eggerapps.at/postico2/ for the latest preview of Postico 2)

@jakob jakob closed this as completed Aug 24, 2021
@vergenzt
Copy link

vergenzt commented Jun 3, 2022

Hi - is there any way to configure Postico's JSON pretty printing to apply to Redshift's JSON column type, which confusingly is called "super" instead of "json" or "jsonb"?

(edit: sorry, just saw #570. will post there instead!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests