Version: v0.5.0

stable_json

Stable function · Serialize as a document block

Tier: stable · Kind: function · Topic: Serialize as a document block

JuliaPythonRust
stable_jsonstable_jsonstable_json

Julia

stable_json(x)
stable_json(x) -> String

Deterministic JSON: object keys emitted in sorted order at every level, scalars formatted by JSON3. Used for conformance goldens and for structural expression keys (skey) — equal trees always produce equal text.

A const node’s value is written in canonical-number form (EarthSciAST CONFORMANCE_SPEC §5.5.3.1 rule 1: an integral, Int64-representable number as an integer literal, at any depth), as EarthSciAST ≥ 0.10 serializes it, so the text does not depend on the EarthSciAST release or on whether a table was authored [1.0, 2.0] or built in code.

Source

Python

stable_json(x: Any) -> str

Deterministic JSON: sorted object keys at every level, floats in the reference’s layout (canonical_float), a const node’s value in canonical-number form (_canon_numbers, as EarthSciAST >= 0.10 writes it) — emit.jl’s stable_json.

Source

Rust

pub fn stable_json(v: &Value) -> String

Deterministic JSON: sorted object keys at every level, floats in the reference’s layout (canonical_float), every other scalar by serde_json. A const node’s value is written in canonical-number form (CONFORMANCE_SPEC §5.5.3.1 rule 1: an integral, i64-representable number as an integer, at any depth), as earthsci-ast ≥ 0.10 serializes it, so the text does not depend on the earthsci-ast release.

Source · Rust docs