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.jsonData
Web APIや設定ファイルで広く使われるテキストベースのデータ形式。オブジェクトまたは配列から始まることが多いです。
7B {5B [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 == SIGNATUREconst SIGNATURE = [0x7b];
const OFFSET = 0;
// bytes: a Uint8Array / Buffer holding the start of the file
export function isJson(bytes) {
return SIGNATURE.every((byte, i) => bytes[OFFSET + i] === byte);
}package fileid
import "bytes"
var isjsonSignature = []byte{0x7b}
const isjsonOffset = 0
func IsJson(b []byte) bool {
end := isjsonOffset + len(isjsonSignature)
if len(b) < end {
return false
}
return bytes.Equal(b[isjsonOffset:end], isjsonSignature)
}const SIGNATURE: &[u8] = &[0x7b];
const OFFSET: usize = 0;
fn is_json(bytes: &[u8]) -> bool {
bytes.get(OFFSET..OFFSET + SIGNATURE.len()) == Some(SIGNATURE)
}<?php
$signature = "\x7b";
$offset = 0;
function is_json(string $bytes): bool {
global $signature, $offset;
return substr($bytes, $offset, strlen($signature)) === $signature;
}JavaScript Object Notation はデータ交換、インポート/エクスポート、パーサのテスト、検証ワークフローで使われます。エンコーディング・区切り文字・バージョン・コンテナ構造が実装の挙動を変えることがあります。
形式が判定できたからといって、信頼できない入力が安全とは限りません。パーサ例外・巨大ファイル・想定外のエンコーディング・外部参照を考慮してください。
11 個のサンプルで、先頭バイト判定・パーサのエラー・アップロード上限・ダウンロード挙動をテストできます。
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.jsonBlue 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.json13424717c87f786e7bcee999a47d958e60c0befc3456dbf6a1ddc9de7f7f13e6Flower 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.json639ca42d44746f8d2d5553fe737f18a7c49524332eb7558e1a920a6d4283a6c4Navy 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.json8d41fe37d5a796b6ec3d08b6acfdf94c988e4ccd184f26c137b8569095cbdd97Nature 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.json99ee168edc0b2ccff52ac45d6917312dfb924f37a7e429cfac14b79057f2e198Sky 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.json6aa1c8bc4fc46d769a7adddb67d0a9eafc78e68305400bf7840700cf7da88947Starry 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.json88daf0799c063059e82966648aebdc2a99d6127b86e40c969350da16ffb56698Blue 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.json811f6083cba15f1817a71a7165c09cec75656e2c7bc8ec8adde2ecf15ce9c988Hibiscus 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.json941fa1a5c64dfc77b8b0a047b4d07df12d2008dc8f402883e218d228ac9a8ee0Arctic 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.jsonc55d9943edf58b8b40ddde65e89a9e7ac32f5a26619cc5605dd6214e3533b6e5NASA 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.jsonab16f5b759281d30393fe3fd61d080a2ead45dc82f1d1f1caa625f750aef54ddJavaScript Object Notation ファイルはバイトシグネチャ 7B ("{") または 5B ("[") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。
JavaScript Object Notation のMIMEタイプは application/json です。
JavaScript Object Notation ファイルは .json 拡張子を使います。拡張子は慣習にすぎず中身を保証しないため、シグネチャや構造のチェックと組み合わせてください。