Тема: 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: одна каноническая единица для каждого вида величины, единица в имени поля при фиксированной единице и объект «значение плюс единица» с контролируемым кодом для смешанных единиц, явная точность вместо подсчёта цифр и строки там, где важны точные десятичные значения.
-
Работа с JSON в командной строке с помощью jq
jq читает JSON, применяет фильтр и печатает результат: используйте -r для простых строк, -c для одного объекта на строку, --arg и --argjson для безопасной передачи значений, -e для преобразования null или false в код завершения, а 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.
-
BigInt в JSON: определите контракт полей без потерь, прежде чем добавлять 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