nodejs-polars
    Preparing search index...

    Function readJSON

    • Read a JSON file or string into a DataFrame.

      Parameters

      • pathOrBody: string | Buffer<ArrayBufferLike>

        path or buffer or string

        • path: Path to a file or a file like string. Any valid filepath can be used. Example: file.csv.
        • body: String or buffer to be read as a CSV
      • Optionaloptions: Partial<ReadJsonOptions>
        • inferSchemaLength

          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).

        • jsonFormat

          Either "lines" or "json"

        • batchSize

          Number of lines to read into the buffer at once. Modify this to change performance.

      Returns pl.DataFrame

      (DataFrame)

      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)
      ╭─────┬─────┬─────╮
      abc
      │ --- ┆ --- ┆ --- │
      i64stri64
      ╞═════╪═════╪═════╡
      1foo3
      ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
      2bar6
      ╰─────┴─────┴─────╯