From 362bd15c8ef3815e0ebc5f699be09c6afc5057f3 Mon Sep 17 00:00:00 2001 From: Murtuza Zabuawala Date: Tue, 28 Nov 2017 14:21:31 +0000 Subject: [PATCH] Format JSON/JSONB nicely when displaying it in the grid editor pop-up. Fixes #2748 --- web/pgadmin/static/js/slickgrid/editors.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/pgadmin/static/js/slickgrid/editors.js b/web/pgadmin/static/js/slickgrid/editors.js index ab0bff0d6..0b38da532 100644 --- a/web/pgadmin/static/js/slickgrid/editors.js +++ b/web/pgadmin/static/js/slickgrid/editors.js @@ -387,12 +387,12 @@ this.loadValue = function (item) { var data = defaultValue = item[args.column.field]; if (data && typeof data === "object" && !Array.isArray(data)) { - data = JSON.stringify(data); + data = JSON.stringify(data, null, 4); } else if (Array.isArray(data)) { var temp = []; $.each(data, function(i, val) { if (typeof val === "object") { - temp.push(JSON.stringify(val)); + temp.push(JSON.stringify(val, null, 4)); } else { temp.push(val) } @@ -722,12 +722,12 @@ this.loadValue = function (item) { var data = defaultValue = item[args.column.field]; if (typeof data === "object" && !Array.isArray(data)) { - data = JSON.stringify(data); + data = JSON.stringify(data, null, 4); } else if (Array.isArray(data)) { var temp = []; $.each(data, function(i, val) { if (typeof val === "object") { - temp.push(JSON.stringify(val)); + temp.push(JSON.stringify(val, null, 4)); } else { temp.push(val) }