file in abyss
フォーマット一覧へ戻る

Data

JSON JavaScript Object Notation

Web APIや設定ファイルで広く使われるテキストベースのデータ形式。オブジェクトまたは配列から始まることが多いです。

Extensions .json
MIME application/json

マジックナンバー

ファイルを解析
オフセット 0 JSON object start
7B
{
オフセット 0 JSON array start
5B
[

構造

  1. Value
  2. Objects
  3. Arrays
  4. Strings
  5. Numbers

注意点

  • JSONはBOMや空白から始まることがあり、先頭1バイトだけでは厳密判定できません。

判定コード例

SIGNATURE = bytes.fromhex("7b")
OFFSET = 0

def is_json(path: str) -> bool:
    with open(path, "rb") as f:
        f.seek(OFFSET)
        head = f.read(len(SIGNATURE))
    return head == SIGNATURE

実践的な使い方

ユースケース

JavaScript Object Notation はデータ交換、インポート/エクスポート、パーサのテスト、検証ワークフローで使われます。エンコーディング・区切り文字・バージョン・コンテナ構造が実装の挙動を変えることがあります。

よくある判定ミス

  • .json という拡張子だけではファイルの中身を保証できません。アップロードや変換の処理では、拡張子・MIMEタイプ・先頭バイト・形式固有の構造チェックを組み合わせるべきです。
  • JavaScript Object Notation は 7B または 5B のようなシグネチャで始まりますが、関連するコンテナや破損ファイルでは追加の検証が必要になる場合があります。

セキュリティ上の注意

形式が判定できたからといって、信頼できない入力が安全とは限りません。パーサ例外・巨大ファイル・想定外のエンコーディング・外部参照を考慮してください。

サンプルの活用

11 個のサンプルで、先頭バイト判定・パーサのエラー・アップロード上限・ダウンロード挙動をテストできます。

サンプルファイル

11 / 11 files
Sample Traits Size Source / license / SHA-256
Data

Package JSON

Package JSON is a JavaScript Object Notation sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.

package.json
Type Sample
Small file
153 B
Generated CC0 1.0
SHA-256 4aeb5d23399187bdf1741cfd857a3bdef95d6cf252c08f3ca67fd3aa7e53cf9c
Download
Data

Blue Sky JSON

Blue Sky JSON is a JavaScript Object Notation sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

01-blue-sky.json
Type Sample
Small file
295 B
SHA-256 13424717c87f786e7bcee999a47d958e60c0befc3456dbf6a1ddc9de7f7f13e6
Download
Data

Flower Garden JSON

Flower Garden JSON is a JavaScript Object Notation sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

02-flower-garden.json
Type Sample
Small file
447 B
SHA-256 639ca42d44746f8d2d5553fe737f18a7c49524332eb7558e1a920a6d4283a6c4
Download
Data

Navy Blue Sky JSON

Navy Blue Sky JSON is a JavaScript Object Notation sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

03-navy-blue-sky.json
Type Sample
Small file
525 B
SHA-256 8d41fe37d5a796b6ec3d08b6acfdf94c988e4ccd184f26c137b8569095cbdd97
Download
Data

Nature of the Sky JSON

Nature of the Sky JSON is a JavaScript Object Notation sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

04-nature-sky.json
Type Sample
Small file
625 B
SHA-256 99ee168edc0b2ccff52ac45d6917312dfb924f37a7e429cfac14b79057f2e198
Download
Data

Sky Landscape JSON

Sky Landscape JSON is a JavaScript Object Notation sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

05-sky-landscape.json
Type Sample
Small file
787 B
SHA-256 6aa1c8bc4fc46d769a7adddb67d0a9eafc78e68305400bf7840700cf7da88947
Download
Data

Starry Sky JSON

Starry Sky JSON is a JavaScript Object Notation sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

06-starry-sky.json
Type Sample
Small file
757 B
SHA-256 88daf0799c063059e82966648aebdc2a99d6127b86e40c969350da16ffb56698
Download
Data

Blue Night Sky JSON

Blue Night Sky JSON is a JavaScript Object Notation sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

07-blue-night-sky.json
Type Sample
Small file
913 B
SHA-256 811f6083cba15f1817a71a7165c09cec75656e2c7bc8ec8adde2ecf15ce9c988
Download
Data

Hibiscus Flower JSON

Hibiscus Flower JSON is a JavaScript Object Notation sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

08-hibiscus-flower.json
Type Sample
1.1 KB
SHA-256 941fa1a5c64dfc77b8b0a047b4d07df12d2008dc8f402883e218d228ac9a8ee0
Download
Data

Arctic Sky JSON

Arctic Sky JSON is a JavaScript Object Notation sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

09-arctic-sky.json
Type Sample
1.1 KB
SHA-256 c55d9943edf58b8b40ddde65e89a9e7ac32f5a26619cc5605dd6214e3533b6e5
Download
Data

NASA Blue Marble JSON

NASA Blue Marble JSON is a JavaScript Object Notation sample based on NASA Image and Video Library. It can be used to test downloads, parsers, previews, and file type detection.

nasa-blue-marble-2012-east.json
Type Sample
1.8 KB
SHA-256 ab16f5b759281d30393fe3fd61d080a2ead45dc82f1d1f1caa625f750aef54dd
Download

よくある質問

JavaScript Object Notation のマジックナンバー(ファイルシグネチャ)は?

JavaScript Object Notation ファイルはバイトシグネチャ 7B ("{") または 5B ("[") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。

JavaScript Object Notation のMIMEタイプは?

JavaScript Object Notation のMIMEタイプは application/json です。

JavaScript Object Notation の拡張子は?

JavaScript Object Notation ファイルは .json 拡張子を使います。拡張子は慣習にすぎず中身を保証しないため、シグネチャや構造のチェックと組み合わせてください。

関連フォーマット