@@ -468,36 +468,37 @@ <h2 class="system-info-heading">System Information</h2>
468468 // Function to recursively create formatted HTML
469469 function formatJSON ( obj , indent = 0 , isTopLevel = true ) {
470470 const indentString = ' ' . repeat ( indent )
471- let html = ''
471+ let result = ''
472472
473473 if ( Array . isArray ( obj ) ) {
474- html += '[\n'
474+ result += '[\n'
475475 obj . forEach ( ( item , index ) => {
476- html += indentString + ' '
477- html += formatJSON ( item , indent + 1 , false )
478- if ( index < obj . length - 1 ) html += ','
479- html += '\n'
476+ result += indentString + ' '
477+ result += formatJSON ( item , indent + 1 , false )
478+ if ( index < obj . length - 1 ) result += ','
479+ result += '\n'
480480 } )
481- html += indentString + ']'
481+ result += indentString + ']'
482482 } else if ( typeof obj === 'object' && obj !== null ) {
483- html += '{\n'
483+ result += '{\n'
484484 const keys = Object . keys ( obj )
485485 keys . forEach ( ( key , index ) => {
486- html += indentString + ' '
487- html += isTopLevel ? `<strong> "${ key } "</strong> : ` : `"${ key } ": `
488- html += formatJSON ( obj [ key ] , indent + 1 , false )
489- if ( index < keys . length - 1 ) html += ','
490- html += '\n'
486+ result += indentString + ' '
487+ result += isTopLevel ? `"${ key } ": ` : `"${ key } ": `
488+ result += formatJSON ( obj [ key ] , indent + 1 , false )
489+ if ( index < keys . length - 1 ) result += ','
490+ result += '\n'
491491 } )
492- html += indentString + '}'
492+ result += indentString + '}'
493493 } else {
494- html += JSON . stringify ( obj )
494+ result += JSON . stringify ( obj )
495495 }
496496
497- return html
497+ return result
498498 }
499499
500- preElement . innerHTML = formatJSON ( jsonObject )
500+ const formattedJSON = formatJSON ( jsonObject )
501+ preElement . appendChild ( document . createTextNode ( formattedJSON ) )
501502 jsonObjectElement . appendChild ( preElement )
502503 } catch ( error ) {
503504 console . error ( 'Error parsing JSON:' , error )
0 commit comments