html语法:
<div id="outputjson"></div>
// 异步读取JSON文件 fetch('/json/data.json') .then(response => response.json()) .then(data => { // 将JSON内容转换为HTML并插入到页面中 document.getElementById('outputjson').innerHTML = '<pre>' + JSON.stringify(data, null, 2) + '</pre>'; }) .catch(error => console.error('Error reading JSON file:', error));