Parse JSON text into a DataFrame with
readJson() and serialize back with toJson(). Mirrors
pandas
read_json() and
pandas
DataFrame.to_json(), supporting five orient formats.
Edit any code block below and press ▶ Run
(or Ctrl+Enter) to execute it live in your browser.
The "records" orient is an array of row objects — the most
natural JSON format for tabular data. Auto-detected when the input is a
JSON array.
The "split" orient stores columns, index, and data
separately — compact and lossless. Auto-detected when the root object
contains "columns" and "data" keys.
The "index" orient uses row-index labels as keys, each
mapping to a record of column values.
The "columns" orient uses column names as keys, each
mapping to an object of index-label → value pairs. Useful for
column-major storage.
The "values" orient is a plain 2-D array — no index or
column labels. Columns are auto-named "0",
"1", etc.
toJson(df, options) serializes a DataFrame
to a JSON string. Choose any orient and optionally pretty-print with
indent.
A DataFrame serialized with toJson can be
reconstructed with readJson without data loss.
Parse JSON into a DataFrame or serialize a DataFrame back to JSON.
Five orient formats are supported: records,
split, index, columns, and
values.
// Parse JSON → DataFrame
readJson(json: string, options?: {
orient?: "records" | "split" | "index" | "columns" | "values",
}): DataFrame
// Serialize DataFrame → JSON
toJson(df: DataFrame, options?: {
orient?: "records" | "split" | "index" | "columns" | "values",
indent?: number,
}): string