16
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

javascriptでconsoleにオブジェクト、XML、JSONを出力する

Last updated at Posted at 2016-02-13

はじめに

javascriptでconsoleにログや取得した情報を出力して内容を確認するときにはよくconsole.log()を利用しますが、オブジェクトだと[object object]となってしまいます。

オブジェクトなどをconsoleに出力したい場合の方法です。
WordpressからRSSで記事を取得してhtmlに表示したいなどといった場合に利用できます。

objectの出力

console.dir(OBJ);

XMLの出力

console.dirxml(XML);

jsonの出力

console.log(JSON.stringify(JSON));

16
19
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
16
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?