Enum polars_io::json::JsonFormat
source · pub enum JsonFormat {
Json,
JsonLines,
}
json
only.Expand description
The format to use to write the DataFrame to JSON: Json
(a JSON array) or JsonLines
(each row output on a
separate line). In either case, each row is serialized as a JSON object whose keys are the column names and whose
values are the row’s corresponding values.
Variants§
Json
A single JSON array containing each DataFrame row as an object. The length of the array is the number of rows in the DataFrame.
Use this to create valid JSON that can be deserialized back into an array in one fell swoop.
JsonLines
Each DataFrame row is serialized as a JSON object on a separate line. The number of lines in the output is the number of rows in the DataFrame.
The JSON Lines format makes it easy to read records in a streaming fashion, one (line) at a time. But the output in its entirety is not valid JSON; only the individual lines are.
It is recommended to use the file extension .jsonl
when saving as JSON Lines.
Auto Trait Implementations§
impl Freeze for JsonFormat
impl RefUnwindSafe for JsonFormat
impl Send for JsonFormat
impl Sync for JsonFormat
impl Unpin for JsonFormat
impl UnwindSafe for JsonFormat
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more