Function readJSONStream

  • Read a newline delimited JSON stream into a DataFrame.

    Parameters

    • stream: Readable

      readable stream containing json data

    • Optionaloptions: Partial<ReadJsonOptions>

    Returns Promise<pl.DataFrame>

    >>> const readStream = new Stream.Readable({read(){}});
    >>> readStream.push(`${JSON.stringify({a: 1, b: 2})} \n`);
    >>> readStream.push(`${JSON.stringify({a: 2, b: 2})} \n`);
    >>> readStream.push(`${JSON.stringify({a: 3, b: 2})} \n`);
    >>> readStream.push(`${JSON.stringify({a: 4, b: 2})} \n`);
    >>> readStream.push(null);

    >>> pl.readJSONStream(readStream, { format: "lines" }).then(df => console.log(df));
    shape: (4, 2)
    ┌─────┬─────┐
    ab
    │ --- ┆ --- │
    i64i64
    ╞═════╪═════╡
    12
    ├╌╌╌╌╌┼╌╌╌╌╌┤
    22
    ├╌╌╌╌╌┼╌╌╌╌╌┤
    32
    ├╌╌╌╌╌┼╌╌╌╌╌┤
    42
    └─────┴─────┘