您遇到的直接问题是,当前编写的代码期望响应为JSON,但是响应实际上是您需要处理以获取JSON的Promise。
因此,您需要执行以下操作:
fetch("https://example.com") .then(response => response.json()) .then(jsondata => console.log(jsondata))
您遇到的直接问题是,当前编写的代码期望响应为JSON,但是响应实际上是您需要处理以获取JSON的Promise。
因此,您需要执行以下操作:
fetch("https://example.com") .then(response => response.json()) .then(jsondata => console.log(jsondata))