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

Data

NDJSON Newline Delimited JSON

1行に1つのJSON値を並べるストリーミング向けデータ形式。ログやバッチ処理でよく使われます。

Extensions .ndjson, .jsonl
MIME application/x-ndjson, application/jsonl

マジックナンバー

ファイルを解析
オフセット 0 JSON objectで始まるNDJSONサンプル
7B
{

構造

  1. JSON value per line
  2. Newline separators

注意点

  • 通常のJSON配列とは異なり、ファイル全体は単一JSON値ではありません。

判定コード例

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

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

実践的な使い方

ユースケース

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

よくある判定ミス

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

セキュリティ上の注意

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

サンプルの活用

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

サンプルファイル

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

Blue Sky NDJSON

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

01-blue-sky.ndjson
Type Sample
Small file
156 B
SHA-256 8d7276a1905675b2c4c3408161571e16d7fdcf3fdbf489cf9210b778e404217a
Download
Data

Flower Garden NDJSON

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

02-flower-garden.ndjson
Type Sample
Small file
362 B
SHA-256 64a8414758a1c618180e343e7673d20f271e469c8ccbdb129fd552999cf1685a
Download
Data

Navy Blue Sky NDJSON

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

03-navy-blue-sky.ndjson
Type Sample
Small file
519 B
SHA-256 d667e600fe8e879f57c6718162c6c437506f19545b0dda322ab955cf4b0d469b
Download
Data

Nature of the Sky NDJSON

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

04-nature-sky.ndjson
Type Sample
Small file
660 B
SHA-256 35bb71f13fe7599219a4c6aa2817da266b1b412f2c9e2fb6ba0faa12a2006d83
Download
Data

Sky Landscape NDJSON

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

05-sky-landscape.ndjson
Type Sample
Small file
910 B
SHA-256 621e500353508a74dc3f718738eae9ee8cffadd7aab152c4d88caeb61ef189ef
Download
Data

Starry Sky NDJSON

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

06-starry-sky.ndjson
Type Sample
Small file
990 B
SHA-256 37c19e64aff8b6b4a91645f79761e28a5007f74a81e381828f1b01a107d9cfc9
Download
Data

Blue Night Sky NDJSON

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

07-blue-night-sky.ndjson
Type Sample
1.1 KB
SHA-256 34467b79eee3ed7184243cdf8a764937d213c7809def48448f2e0e24f90d01f2
Download
Data

Hibiscus Flower NDJSON

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

08-hibiscus-flower.ndjson
Type Sample
1.5 KB
SHA-256 1d50dcf715c4fe621060ee607ce86518633e0ad2ffcb456d7bf28cea30bb0411
Download
Data

Arctic Sky NDJSON

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

09-arctic-sky.ndjson
Type Sample
1.5 KB
SHA-256 041153e643f792c655c8f6312f481bd6570b4b9c8ac73f0263697f9ebf2fc7c3
Download
Data

Sunset Rays NDJSON

Sunset Rays NDJSON is a Newline Delimited JSON sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

10-sunset-rays.ndjson
Type Sample
1.7 KB
SHA-256 795d3f86a48a48d3cb46d9a65d791673017c54e4b11bdd84f4b5a15889af3b1d
Download
Data

NASA Blue Marble NDJSON

NASA Blue Marble NDJSON is a Newline Delimited JSON 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.ndjson
Type Sample
2.4 KB
SHA-256 e108e76333f8782f2f3d7636a7245b5ee0340132e6057c08e7ec6d28d7b991cc
Download

よくある質問

Newline Delimited JSON のマジックナンバー(ファイルシグネチャ)は?

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

Newline Delimited JSON のMIMEタイプは?

Newline Delimited JSON のMIMEタイプは application/x-ndjson, application/jsonl です。

Newline Delimited JSON の拡張子は?

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

関連フォーマット