Skip to main content

Module json

Module json 

Source
Expand description

A JSON writer, because the alternative is 30 crates.

Mira serializes exactly one shape โ€” query results โ€” and it does so from hand-written code that already knows the shape statically. serde_json would buy derive macros for structs that do not exist here (results are built column-wise straight out of Arrow arrays, never as a tree of Rust values) at the cost of serde + serde_json + syn + quote + proc-macro2 and a compile-time hit on every build. This is the whole feature in a hundred lines.

The nesting API takes a closure per container so brackets cannot be unbalanced and commas cannot be missed: there is no end_object to forget.

Structsยง

Json
Incrementally built JSON. key before a value inside obj, bare values inside arr.

Constantsยง

HEX ๐Ÿ”’

Functionsยง

escape ๐Ÿ”’
RFC 8259 string escaping, including the control characters below 0x20 that the spec requires be escaped and that a naive writer silently emits raw.
itoa ๐Ÿ”’
ryu_lite ๐Ÿ”’