polars.DataFrame.write_ndjson#
- DataFrame.write_ndjson(file: None = None) str[source]#
 - DataFrame.write_ndjson(file: IOBase | str | Path) None
 Serialize to newline delimited JSON representation.
- Parameters:
 - file
 File path or writeable file-like object to which the result will be written. If set to
None(default), the output is returned as a string instead.
Examples
>>> df = pl.DataFrame( ... { ... "foo": [1, 2, 3], ... "bar": [6, 7, 8], ... } ... ) >>> df.write_ndjson() '{"foo":1,"bar":6}\n{"foo":2,"bar":7}\n{"foo":3,"bar":8}\n'