Тема: 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.
-
Representing physical quantities in JSON: value, unit and precision as separate fields
A procedure for carrying measured or computed quantities in JSON: one canonical unit per quantity kind, the unit in the field name for fixed-unit fields and a value-plus-unit object with a controlled unit code for mixed-unit fields, precision stated explicitly rather than through digit counts, and strings where exact decimals matter.
-
Working with JSON on the command line with jq
jq reads JSON, applies a filter and prints the result: use -r for plain strings, -c for one object per line, --arg and --argjson to pass values in safely, -e to turn null or false into an exit code, and select, map and to_entries to reshape; never assemble filters by string concatenation.
-
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.
-
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