@@ -17,6 +17,7 @@ import { TYPE } from "vue-toastification";
17
17
import { ExtendedFailedMessage , FailedMessageError , FailedMessageStatus , isError } from " @/resources/FailedMessage" ;
18
18
import Message from " @/resources/Message" ;
19
19
import { NServiceBusHeaders } from " @/resources/Header" ;
20
+ import { parse , stringify } from " lossless-json" ;
20
21
21
22
let refreshInterval: number | undefined ;
22
23
let pollingFaster = false ;
@@ -154,8 +155,8 @@ async function downloadBody(message: ExtendedFailedMessage) {
154
155
try {
155
156
switch (response .headers .get (" content-type" )) {
156
157
case " application/json" : {
157
- let jsonBody = await response .json ();
158
- jsonBody = JSON . parse (JSON . stringify ( jsonBody ) .replace (/ \\ "| "(?:\\ "| [^ "] )* "| (\/\/ . * | \/\* [\s\S ] *? \*\/ )/ g , (m , g ) => (g ? " " : m )));
158
+ const jsonBodyRaw = await response .text ();
159
+ const jsonBody = parse (jsonBodyRaw .replace (/ \\ "| "(?:\\ "| [^ "] )* "| (\/\/ . * | \/\* [\s\S ] *? \*\/ )/ g , (m , g ) => (g ? " " : m )));
159
160
message .messageBody = formatJson (jsonBody );
160
161
return ;
161
162
}
@@ -260,8 +261,8 @@ function formatXml(xml: string) {
260
261
return string .trim ();
261
262
}
262
263
263
- function formatJson(json : string ) {
264
- return JSON . stringify (json , null , 2 );
264
+ function formatJson(json : unknown ) {
265
+ return stringify (json , null , 2 ) as string ;
265
266
}
266
267
267
268
function togglePanel(panelNum : number ) {
0 commit comments