jakob / Postico

Public issue tracking for Postico

Home Page:https://eggerapps.at/postico/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSON viewer for working with JSON/JSONB columns

cymen opened this issue · comments

It would be great to have a nicer viewer for the JSON/JSONB columns/cells. Maybe on mouse hover one could see nicely formatted JSON to make it easier to look through instead of a compacted string.

and editing.

One of the best features of Postgres is the native JSON support. I use it all the time.

commented

+1

For me the most important part would be to have a JSON viewer in the query result window. I frequently write long queries that produce JSON that will then be directly passed to templating engines. This quickly gets unwieldy and I'm currently resorting to copy-pasting the code to my text editor end reformatting the JSON there to see whats going on. Having a special result viewer for queries that return one single row/column that only contains one big JSON object would be great.

Bonus points for the JSON viewer remembering the previously opened/closed nodes. If the default view is all nodes open, the viewer should remember the paths of the user-closed-nodes and resorts that state (vice versa if nodes are default open).

We also use a lot of JSON/JSONB and editing it in Postico is a nearly impossible.

Editing currently involves copying the JSON field, pasting it into an editor, hitting format, changing the value, then pasting it back into Postico. Viewing a JSON field just involves the first 3 steps. It works, but is pretty annoying. Anything to make this process less painful would be much appreciated.

We have a lot of JSONB data in our DB so a lightweight editor with syntax highlighting would be highly appreciated.

A solution would also be to have Postico somehow open the JSON in an external editor (e.g. VSCode), then listen for save events on the temporary file so that once it's saved via Cmd+S in VSCode it reflects in the pending changes in Postico.

Thoughts?

The 2.0 beta version has a JSON editor in the side panel, that's what we've been using. If you like VSCode, check out Azure Data Studio.

@iguana the same editor is in the current stable version (1.5) but it's far from ideal:

  1. no syntax highlighting
  2. hard to make lots of changes as it's small unless you keep expanding and shrinking the side panel
  3. no autocompletion for double quotes and curly/square brackets

Also, I'm not sure in what context you are recommending Azure Data Studio as it surely doesn't support PostgreSQL. I mentioned VSCode as a text editor, any other like Atom, Sublime, CotEditor would have worked too if we can implement external editing of the JSON.

Formatting and syntax highlighting would be nice, but right now I would be happy just to have the ability to expand the cell or even just use the down arrow key to navigate text wrapping.

I love postico, but the experience of working with JSON columns is horrible

I've actually switched away from Postico to DataGrip because the latter offers a way better experience when viewing and making changes to JSON data.

viewing JSON would be super, but I'd also like to use "JSON Functions and Operators" in Filters.

Short update: In Postico 2 you can now double click JSON and JSONB fields to show the data in a popover. JSONB is also pretty-printed automatically.

It's not a full fledged JSON editor (just a text editor) but I think it's a nice improvement nevertheless!

I agree that it is already an improvement, thx!

Maybe using a monospace font for the JSON editor would improve readability.

I just noticed the following, not sure if this is the intended behaviour:

The JSON editor is not opened if a JSON cell contains NULL.

If you're like me and wondering where to get Postico 2, search your email for Postico 2 and you should have an email from Jakob that is titled Feedback wanted: Postico 2 Preview (I missed it). At least if you licensed a prior version.

@jakob Is pretty printing for JSON coming too? I happen to be working on a project at the moment that for whatever reason has a lot of JSON columns (not sure why, I suspect when the schema was created, there might have been a lack of understanding of what JSONB is). It would be great to have pretty-printed JSON.

@cymen Regarding Postico 2 preview, there's also an issue pinned to the top of the list here on Github issues: #689. Or you can go directly to https://eggerapps.at/postico2/

Regarding JSON vs. JSONB: We didn't want to enable pretty-printing for JSON since whitespace changes are significant for JSON. We assumed that most people use JSONB anyway.

However, I also assume that the people who use JSON probably do so for historic reasons (it was introduced before JSONB), and that they don't really care about whitespace significance. So it may be worthwhile to treat JSON the same as JSONB in Postico.