0
0

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 1 year has passed since last update.

「Webを支える技術」読書メモ#13 JSON

Posted at

本記事の内容
Webを支える技術を読んだ際のノートのようなものです。
省略している部分もあり、書籍の内容を完全に要約するものではありません。

今回は第14章あたりの内容です。

JSON?

JavaScript Object Nation

  • マークアップはできないけどプログラム的には扱いやすい
  • xmlより冗長性が低い

といあったあたりが旨味。

ハイパーメディアフォーマットとして使う事もできるが、その場合はリンクを入れ忘れないように注意すること。

細々としたポイント

オブジェクト

nameとvalueの組 = メンバ
nameは常にString。

日時

組み込みはないので、js処理系にも依存しないような標準形式が安定。
ということでいつもの(ISO8061)が使われがち。

文字列

エスケープするときは\uXXXXの形式。
\uの後ろは16進数。

JSONP

PはPaddingのP。

勝手に情報を転送しないよう、XMLHttpRequest(Ajaxなどで使われる)などでは
クロスドメイン通信が止められてたりする。
そういったときに<script>タグを使ってクロスドメイン通信をするためのもの。
Ajaxでは必須。

こんな感じで動く。

レスポンスはapplication/javascriptが返る。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?