LoginSignup
3
2

More than 3 years have passed since last update.

エスケープされたJSON文字列からJSON dataに変換する

Posted at

JSON.parseを2回施す。

raw = '"{\\"id\\":\\"123\\"}"'
once = JSON.parse(raw)
twice = JSON.parse(once)
console.log(twice.id) // => "123"

https://stackoverflow.com/questions/25721164/how-to-fix-an-escaped-json-string-javascript

3
2
1

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
3
2