Skip to content

Serialize to JSON representation

Source code

Description

Serialize to JSON representation

Usage

<DataFrame>$write_json(file)

Arguments

file File path to which the result will be written.

Value

NULL invisibly.

Examples

library("polars")


dat <- as_polars_df(head(mtcars))
destination <- tempfile()

dat$select(pl$col("drat", "mpg"))$write_json(destination)
jsonlite::fromJSON(destination)
#>   drat  mpg
#> 1 3.90 21.0
#> 2 3.90 21.0
#> 3 3.85 22.8
#> 4 3.08 21.4
#> 5 3.15 18.7
#> 6 2.76 18.1