1
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 3 years have passed since last update.

JSONとは??

Last updated at Posted at 2021-04-08

Jsonとは??

JavaScript Object Notationの略です。
無理やり訳すとこんな感じです。
Javascriptオブジェクト表記。つまり、JSに基づいたものです。
JavaScriptでオブジェクトを作成する際は {} や [] などの括弧を使って記述しますのでJSONでもその記載方法を使用しています。

記述方法は

  1. {} で囲む
    2) それぞれのデータはキーとValueのペア
     key: 文字列
     Value:データ型 ▶ 文字列はダブルクオーテーションで囲む、数値は実数で記入可能、

XMLとは??

JNSONが出てくる前はXMLを使用していました。
HTMLの記法を元にしたデータ定義方法で、データ定義言語と呼ばれています。
HTMLと同じようにタグを使ってデータの構造を定義しています。
ただ、最近はJSを使うことが多くなったので、上記のJSONを使っているようです。

JSON記入例

index.html
 <script>
  let json_obj = {"id" : 1, "name": "user01", "gender": "woman"}
  let decoded_json = JSON.stringify(json_obj, null , "");
  document.write(decoded_json);
  </script>

ブラウザ上で表示すると以下のようになります。

スクリーンショット 2021-04-11 13.40.27.png

1
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
1
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?