File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed
src/main/resources/static/js Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,19 @@ function isStringDefined(value) {
104
104
return isDefined ;
105
105
}
106
106
107
+ function parseJsonObject ( value ) {
108
+ try {
109
+ var json = JSON . parse ( value ) ;
110
+ if ( json !== null && typeof json === "object" ) {
111
+ return json ;
112
+ } else {
113
+ return undefined ;
114
+ }
115
+ } catch ( e ) {
116
+ return undefined ;
117
+ }
118
+ }
119
+
107
120
// /Stop ## Common functions ##################################
108
121
109
122
// Start ## Routing ##
Original file line number Diff line number Diff line change @@ -109,9 +109,17 @@ jQuery(document).ready(function () {
109
109
tdKey . setAttribute ( 'class' , 'left-table-pane' ) ;
110
110
tdKey . appendChild ( document . createTextNode ( key ) ) ;
111
111
tr . appendChild ( tdKey ) ;
112
- var tdValue = document . createElement ( 'td' ) ;
113
- tdValue . appendChild ( document . createTextNode ( value ) ) ;
114
- tr . appendChild ( tdValue ) ;
112
+ var element = document . createElement ( 'td' ) ;
113
+ var json = parseJsonObject ( value ) ;
114
+ if ( json != undefined ) {
115
+ value = JSON . stringify ( json , undefined , 2 ) ;
116
+ pre = document . createElement ( 'pre' ) ;
117
+ pre . appendChild ( document . createTextNode ( value ) ) ;
118
+ element . appendChild ( pre ) ;
119
+ } else {
120
+ element . appendChild ( document . createTextNode ( value ) ) ;
121
+ }
122
+ tr . appendChild ( element ) ;
115
123
return tr ;
116
124
}
117
125
You can’t perform that action at this time.
0 commit comments