The package registry is still being built. The docs are live, everything else is a preview.

Edge Python

Sign In

Sign in to publish packages and pin them by sha256.


By continuing, you accept our Terms and Conditions.

@
Palette

json (js, cli)

json is loads and dumps. Declare it with edge add json and import it by bare name. To pin a different version, point the edge.json entry at another URL, see Modules.

loads accepts the object_hook, object_pairs_hook, parse_float, parse_int, and parse_constant callables. dumps accepts indent, sort_keys, ensure_ascii, check_circular, allow_nan, skipkeys, default, separators, and cls. Parse failures raise ValueError, nesting deeper than 1000 levels raises RuntimeError, and a non-serializable value raises TypeError unless default handles it. Integers cross as 128-bit values, so loads accepts numbers beyond 64 bits. Non-finite floats map to NaN, Infinity, and -Infinity on both sides, and integer-valued floats dump with a trailing .0 so a round-trip preserves the type.

cmd + enter
ada
{"k":[1,2,3],"ok":true}
Output

indent and sort_keys shape the output:

cmd + enter
{
  "a": [
    true,
    null
  ],
  "b": 1
}
Output

A round-trip preserves types, even past 64 bits:

cmd + enter
True
3.0
3.0
Output

Failures raise ordinary exceptions you can catch:

cmd + enter
parse failed: unknown literal at byte 1
dump failed: 'function' is not JSON-serializable
Output