path or buffer or string
file.csv
.Optional
options: Partial<ReadJsonOptions>Maximum number of lines to read to infer schema. If set to 0, all columns will be read as pl.Utf8.
If set to null
, a full table scan will be done (slow).
Either "lines" or "json"
Number of lines to read into the buffer at once. Modify this to change performance.
const jsonString = `
{"a", 1, "b", "foo", "c": 3}
{"a": 2, "b": "bar", "c": 6}
`
> const df = pl.readJSON(jsonString)
> console.log(df)
shape: (2, 3)
╭─────┬─────┬─────╮
│ a ┆ b ┆ c │
│ --- ┆ --- ┆ --- │
│ i64 ┆ str ┆ i64 │
╞═════╪═════╪═════╡
│ 1 ┆ foo ┆ 3 │
├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
│ 2 ┆ bar ┆ 6 │
╰─────┴─────┴─────╯
Read a JSON file or string into a DataFrame.