テーマ: json
-
Make serialized JSON deterministic for hashes
Define a narrow serialization contract before hashing JSON, and distinguish repeatable Python output from cross-language canonical JSON.
-
JSON で物理量を表す:値、単位、精度を別のフィールドにする
測定または計算した量を JSON で運ぶ手順です。量の種類ごとに正規単位を一つ選び、単位が固定ならフィールド名に含め、混在するなら管理された単位コードと値のオブジェクトを使います。精度は桁数ではなく明示し、正確な十進値が重要なら文字列を使います。
-
jq を使ってコマンドラインで JSON を扱う
jq は JSON を読み、フィルターを適用し、結果を表示する。通常の文字列には -r、1行1オブジェクトには -c、値を安全に渡すには --arg と --argjson、null や false を終了コードにするには -e、構造を変えるには select、map、to_entries を使う。文字列連結でフィルターを組み立ててはならない。
-
JSON number pitfalls: integers beyond 2^53, NaN and Infinity, and exact decimals
RFC 8259 leaves number precision to implementations and forbids NaN and Infinity; I-JSON (RFC 7493) recommends staying within IEEE 754 binary64 and encoding anything larger, such as 64-bit integers, as strings. Python's json module emits NaN by default and JavaScript's JSON.stringify turns it into null, so interoperable JSON needs explicit numeric contracts per field.
-
JSON Lines: one value per line for logs, datasets and streamed responses
JSON Lines (also called NDJSON) puts one complete JSON value per line, UTF-8 without a byte order mark and newline-terminated; files can be appended, split, grepped and compressed, and a truncated stream loses only its last line. RFC 7464 JSON text sequences add a record-separator byte for recovery. Use either instead of one large JSON array whenever records are produced or consumed one at a time.
-
JSON での BigInt:replacer を追加する前に情報を失わないフィールド契約を定める
大きな整数を明示的なスキーマで符号化し、暗黙に Number を経由せずに復元します。
-
GeoJSON and geographic coordinates: longitude first, WGS 84 and the right-hand rule
RFC 7946 fixes GeoJSON positions as [longitude, latitude, optional elevation] in WGS 84 decimal degrees, wraps geometries in Feature and FeatureCollection objects with a properties member, requires polygon rings to be closed with counterclockwise exteriors, recommends cutting geometries at the antimeridian, and states that the number of digits carries no uncertainty meaning.
機械可読: JSON