Convert JSONL to SQL

Turn JSONL files into SQL. SQL in SQLite's dialect that creates one table named data with a row per line, its columns typed by DuckDB, and inserts every row, as SQLite's .dump writes it inside one transaction, so MySQL and PostgreSQL do not run it as it is.

Converted in an isolated sandbox on our serversDeleted after 24 hours

Drop JSONL files on the dialor turn it to pick what to do

A SQL script with one row per line.Each line of the JSONL file becomes a row in a table named data.

  1. What you get

    A SQL file in SQLite's dialect. It creates one table named data, with a row for every line, and inserts every row. The columns are typed by DuckDB.

    The statements are written inside one transaction, the way SQLite's .dump writes them. Any tool that reads SQLite scripts can replay the file.

  2. What changes

    MySQL and PostgreSQL do not run the script as it is, because it is written for SQLite.

    Nested objects and lists are written as text, such as {'id': 1001}. They do not become separate tables or columns.

    Decimals keep every digit SQLite stores, so 41.7 comes out as 41.700000000000002842.

  3. Going the other way

    To turn a SQL file back into lines of JSON, use SQL to JSONL. The conversion has no options, and it produces one file.

JSONL and SQL.What each format is.

The formats

From · JSONL

JSON Lines

JSON Lines, one JSON object per line, the format of logs and datasets.

Extensions
.jsonl .ndjson
MIME type
application/jsonl
Kind
Text and data
To · SQL

SQL Script

SQL statements as text. A database dump that any SQL tool can read or replay.

Extensions
.sql
MIME type
application/sql
Kind
Text and data

In your code.The same JSONL to SQL conversion through the API, for your app or your agent.

terminal
$ cv convert report.jsonl report.sql
$ cv convert report.jsonl report.sql

Questions.What people ask about JSONL to SQL.

01OF 04

SQLite. The script is in SQLite's dialect, so MySQL and PostgreSQL do not run it as it is.

The table is named data. It has a row for each line of the JSONL file.

They are written as text, such as {'id': 1001}. They are not split into separate columns.

Decimals keep every digit SQLite stores. For 41.7, that is 41.700000000000002842.

More conversions.Other ways in and out of JSONL and SQL.