LoginSignup
10
2

More than 3 years have passed since last update.

UnicodeなJSONを日本語変換するならChromeのコンソール使うといいと思う。

Posted at

API叩いたりとかした時に、たまにこういうメッセージ返ってくるじゃないですか。

{
  "error":true,
  "message":"\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3044\u307e\u3059\uff01\uff01\uff01"
}

Screenshot from 2019-12-25 13-55-32.png

Chromeのコンソールにぶちこむと返り値としていい感じに表示してくれる。

firefoxはエラーが起きるので駄目でした。

その他、UnicodeなJSONを日本語変換する方法

コンソールでパース

JSON.parse(`{
  "error":true,
  "message":"\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3044\u307e\u3059\uff01\uff01\uff01"
}`)

これを使うと便利なところはそのまま変数として使ったりがしやすいです。右クリックで Store as global variable を押せば temp1 として使えるようになりました。

Screenshot from 2019-12-25 14-32-06.png

console.dir(temp1) とか console.log 以外も使えます。◯

Screenshot from 2019-12-25 14-39-18.png

エディターにJsonParser系のプラグインをいれる

phpstorm

Screenshot from 2019-12-25 14-40-17.png

その他

JSONじゃなければ、firefoxでも可です!!!

"\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3044\u307e\u3059\uff01\uff01\uff01"

Screenshot from 2019-12-25 14-47-27.png

.

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