Is there a way to view JSON in a pretty format with lines wrapped when selecting the column in DataGrip? In MySQL Workbench there's a nice option of "Open value in Editor". The "Edit Maximized" does not wrap or fit in screen.
DataGrip view JSON in pretty
10.5k Views Asked by John Jai At
4
There are 4 best solutions below
0

Alternatively and if you use PostgreSQL, you can do pretty-format right in the query. Assume items
column is a jsonb
column:
select id, active, jsonb_pretty(items::jsonb) from orders;
0

DataGrip 2022.2.2 here.
Staying in the cell of type "text" and formatting by CTRL+ALT+L didn't work for me. A message saying that the content is already formatted popped up. This only worked when I change the column type to "json".
What has worked for a regular text column is opening the Value Editor by Shift+Enter, then inside the editor right-clicking on an empty space and setting JSON as the formatting language by choosing "Set Highlighting Language..." in the popped-up menu.
At the moment you need to invoke
Reformat code
action when you're inside a cell.Before:
After reformat:
Follow the issue DBE-6670
Update: Starting from 2020.3 Toggle Formatting button in cells Value Editor (right-click on cell, choose Maximize) The formatting mode is available for one-line JSON and XML values. It's turned on by default.