遍历Json数据可参考下面示例:const jsonStr = '{"name": "Alice", "age": 30}'; let jsonObj: Object = JSON.parse(jsonStr); let keyArr: string[] = Object.keys(jsonObj); let valueArr: string[] = Object.values(jsonObj); let entryArr: [string, string][] = Object.entries(jsonObj) for (let i = 0; i < entryArr.length; i++) { console.log(keyArr[i] + ":" + valueArr[i]); }
遍历Json数据可参考下面示例: