---
title: "Convert JSON to MariaDB"
description: "Convert JSON files to SQL for MariaDB in your browser: a CREATE TABLE with typed columns, then INSERT statements. Free, and your file is never uploaded."
canonical: https://intosql.com/json-to-mariadb
last_updated: 2026-10-15
---

# Convert JSON to MariaDB

Drop your JSON file to get a MariaDB script with CREATE TABLE and INSERT statements. Each column gets a type, and every fix is listed with its row and column.

## From JSON to MariaDB, column by column

The sample above, pedidos_2024.json, as IntoSQL writes it for MariaDB: what each column holds in the file, the type it gets and how its first value lands in the script.

| In the file | First value | Column | MariaDB type | In the script |
| --- | --- | --- | --- | --- |
| pedido | `000481` | `pedido` | `varchar(8)` | `'000481'` |
| cliente | `Peña Muñoz` | `cliente` | `varchar(16)` | `'Peña Muñoz'` |
| fecha | `2024-02-03T10:15:00Z` | `fecha` | `datetime` | `'2024-02-03 10:15:00'` |
| total | `1234.5` | `total` | `decimal(6,2)` | `1234.5` |
| pagado | `true` | `pagado` | `tinyint(1)` | `TRUE` |
| notas | `` | `notas` | `varchar(32)` | `NULL` |

## Load the script into MariaDB

The download is a plain .sql file. Run it with MariaDB's own tools.

### MariaDB

```shell
mariadb --default-character-set=utf8mb4 mydb < pedidos_2024.mariadb.sql
```

The script sets utf8mb4 itself; the flag makes the client send it the same way, so accents arrive intact. In HeidiSQL or DBeaver, open the script and run it.

Without a script:

```shell
intosql load pedidos_2024.json --into mariadb://user@localhost/mydb
```

## What IntoSQL reads in JSON files

- The file can be an array of objects, an object that holds that array under a key such as data, or one object per line (NDJSON).
- Each key becomes a column. Objects and arrays inside a value are kept as JSON text.
- Numbers keep their exact digits, and ISO 8601 dates become dates or timestamps.

## What to know about MariaDB

- Yes and no values become tinyint(1). Text up to 255 characters is varchar; longer text is text, mediumtext or longtext by size.
- The script uses utf8mb4 and sets the SQL mode, so accents, emoji, backslashes and line breaks load as written.
- MariaDB's datetime stores no time zone.

### How each kind of value is stored in MariaDB

| Value | MariaDB |
| --- | --- |
| Yes and no | `tinyint(1)` |
| Whole numbers | `int` |
| Large whole numbers | `bigint` |
| Decimals | `decimal(p,s) · double` |
| Floating-point numbers | `double` |
| Dates | `date` |
| Times of day | `time(6) · time` |
| Dates with a time | `datetime(6) · datetime` |
| Dates with a time and offset | `datetime(6) · datetime` |
| Text | `varchar(n) · text · mediumtext · longtext` |

## Questions about JSON to MariaDB

### How do I convert JSON to MariaDB?

Drop your file on the converter at the top of this page. It finds the header, reads every value and writes the MariaDB script, listing each fix it made. Download the script and run it with the mariadb client.

### What shape does the JSON file need?

An array of objects, an object that holds that array under a key such as data, or one object per line (NDJSON). Each key becomes a column.

### Which MariaDB types does it use?

Yes and no values become tinyint(1), whole numbers int, decimals decimal(p,s), dates date, dates with a time datetime(6) and text varchar(n). Sizes come from the longest value in each column.

### Does it keep leading zeros in MariaDB?

Yes. A code such as 000481 stays text, so MariaDB stores it as varchar(8) and the script writes it as '000481'.

### Can it load the data into MariaDB without a script?

Yes, with IntoSQL Pro. The desktop app and the command line connect to MariaDB and load the rows straight in, creating the table first.

### How big can the JSON file be?

NDJSON, one object per line, is read as it streams in, so files of several gigabytes work in the browser. A JSON document is read whole, so its limit is the memory the browser gives this page. The desktop app and the command line take files of any size.

## JSON into other databases

- [Convert JSON to SQL](https://intosql.com/json-to-sql)
- [Convert JSON to PostgreSQL](https://intosql.com/json-to-postgresql)
- [Convert JSON to MySQL](https://intosql.com/json-to-mysql)
- [Convert JSON to SQLite](https://intosql.com/json-to-sqlite)
- [Convert JSON to SQL Server](https://intosql.com/json-to-sql-server)
- [Convert JSON to Oracle](https://intosql.com/json-to-oracle)

## Other files into MariaDB

- [Convert Excel to MariaDB](https://intosql.com/excel-to-mariadb)
- [Convert CSV to MariaDB](https://intosql.com/csv-to-mariadb)
