Skip to main content

Module nested_json

Module nested_json 

Source
Expand description

List, array and struct cells as JSON text for one-value-per-field destinations (CSV export, clipboard copies): JSON keeps struct field names and reads back anywhere (str.json_decode). The text is Polars’ JSON writer’s, as in NDJSON export.

Special cases where Polars’ writers panic or have no form: binary is standard base64 everywhere; dates and ms/µs datetimes go in as their written text (values past the calendar as their stored number, as the table shows; ns is always in range); durations are ISO 8601 seconds as the JSON writer spells them (PT3723.004S, -PT1.5S, P0D), exact to the nanosecond.

Enums§

Writer
The writer whose text for a date or datetime calendar_as_text writes.

Functions§

calendar_as_text
A date or datetime column as the text writer writes for it, with its nulls; a value past the calendar’s range, on which the writers panic, as its stored number (crate::exact::out_of_range), as the table shows it.
column_as_json
One nested column as a String column of JSON, null where the value is null.
duration_as_iso
A duration column as a String column of duration_iso text, with its nulls.
duration_iso
value units as ISO 8601, as Polars’ JSON writer (chrono’s TimeDelta) spells it: whole seconds plus significant fraction digits, P0D for zero, - when negative. Computed here: chrono’s range stops short of i64::MIN ms.
frame_as_cells
frame_as_json with dates and datetimes kept in their own type: the cells a Markdown or HTML copy writes through crate::exact::value_text, which spells one past the calendar as its stored number itself.
frame_as_json
lazy_as_json for frames already in memory: a copy’s rows, as the CSV writer takes them.
has_binary
Whether dtype is binary or has binary anywhere inside.
is_nested
Whether a column is a list, array or struct, which a delimited writer takes only as JSON text.
lazy_as_json
lf with every column a CSV writer cannot take (needs_text) replaced by its text, in place and under its own name: what a CSV export writes. Planned, not run: the text is built as the rows are collected.
lazy_for_json
lf with every column that has binary, a date or a datetime in it as text (leaves_as_json_text), in place and under its own name: what a JSON export writes. Planned, not run.
leaves_as_json_text
series with every binary value, at any depth, as its base64 text, and every date and datetime as the JSON writer’s text (calendar_as_text). Lists, arrays and structs keep their shape and their nulls.
needs_text
Whether a column needs to become text before a CSV writer takes it: it is nested, binary, a duration, or a date or datetime in ms or us, which the writer can panic on.