nodejs-polars
    Preparing search index...

    Function scanJson

    • Lazily read from a newline delimited JSON file or multiple files via glob patterns.

      This allows the query optimizer to push down predicates and projections to the scan level, thereby potentially reducing memory overhead.

      Note: Currently only newline delimited JSON is supported

      Parameters

      • path: string

        path to json file

        • path: Path to a file or a file like string. Any valid filepath can be used. Example: ./file.json.
      • Optionaloptions: Partial<ScanJsonOptions>
        • inferSchemaLength

          Maximum number of rows to scan for schema inference. If set to null, the full data may be scanned (this is slow). Default -> 100

        • schema

          Declare the schema of the frame. Types that are not given are inferred.

        • schemaOverrides

          Override the dtype of one or more columns; note that any dtypes inferred from the schema param will be overridden.

        • batchSize

          Number of rows to read in each batch.

        • nRows

          Stop reading from the JSON file after reading nRows.

        • lowMemory

          Reduce memory pressure at the expense of performance.

        • rechunk

          Reallocate to contiguous memory when all chunks/files are parsed.

        • ignoreErrors

          Return null if parsing fails because of a schema mismatch.

        • rowIndexName

          If given, insert a row index column with this name.

        • rowIndexOffset

          Offset to start the row index column at (only used if the name is set).

        • cloudOptions

          Options that indicate how to connect to a cloud provider.

          The cloud providers currently supported are AWS, GCP, and Azure. See supported keys here:

          • aws <https://docs.rs/object_store/latest/object_store/aws/enum.AmazonS3ConfigKey.html>_
          • gcp <https://docs.rs/object_store/latest/object_store/gcp/enum.GoogleConfigKey.html>_
          • azure <https://docs.rs/object_store/latest/object_store/azure/enum.AzureConfigKey.html>_

          If cloudOptions is not provided, Polars will try to infer the information from environment variables.

        • includeFilePaths

          Include the path of the source file(s) as a column with this name.

      Returns LazyDataFrame

      (LazyDataFrame)

      > const df = pl.scanJson('path/to/file.json', {nRows: 2}).collectSync()
      > console.log(df)
      shape: (2, 3)
      ╭─────┬─────┬─────╮
      abc
      │ --- ┆ --- ┆ --- │
      i64stri64
      ╞═════╪═════╪═════╡
      1foo3
      ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
      2bar6
      ╰─────┴─────┴─────╯