LoginSignup
4
2

More than 3 years have passed since last update.

Uncaught SyntaxError: Unexpected token N in JSON の解決方法

Last updated at Posted at 2019-09-19

エラー発生時のコードは以下の通りである。

let data = JSON.parse(yourString);

解決方法は、NaNをnullに変えるだけである。
解決方法を以下に示す。

let data = JSON.parse(yourString.replace(/\bNaN\b/g, "null"));

参考

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2