1.5 KiB
Vendored
1.5 KiB
Vendored
JSON
Support for working with JSON data — load, explore, and save structured JSON using Kotlin DataFrame. Easily handle JSON data in Kotlin — read from files or URLs, and export your data back to JSON format. Kotlin DataFrame support for reading and writing JSON files in a structured and type-safe way.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.
Kotlin DataFrame is suitable only for working with table-like structured JSON — a list of objects where each object represents a row and all objects share the same structure.
Experimental support for OpenAPI JSON schemas is also available.
{style="note"}
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")
Write
You can write a DataFrame to a JSON file using the writeJson() method:
df.writeJson("example.json")