DataFrame 1.0 Help

JSON

Kotlin DataFrame supports reading from and writing to JSON files.

Requires the dataframe-json module, which is included by default in the general dataframe artifact and in %use dataframe for Kotlin Notebook.

Read

You can read a DataFrame or DataRow from a JSON file (via a file path or URL) using the readJson() method:

val df = DataFrame.readJson("example.json")
val df = DataFrame.readJson("https://kotlin.github.io/dataframe/resources/example.json")

A JSON null is read as null, so the corresponding column becomes nullable. A property that some records simply don't have is read as null as well — a DataFrame is rectangular, so every row needs a value in every column.

This also holds for array columns: [null, [123], []] is read as a List<Int>? column holding null, [123], and an empty list.

JSON elements that aren't objects have no property name to use as a column name, so they're read into the special value and array columns. The same special columns are also used to resolve type clashes when the same property contains values of different shapes across records.

Write

You can write a DataFrame to a JSON file using the writeJson() method:

df.writeJson("example.json")

A DataFrame read from JSON with a top-level type clash is written back to its original form; see writing to JSON for the details and for the cases that don't round-trip.

29 September 2026