Convert db to json

Free online DB to JSON converter

Convert supported DB files to JSON for APIs, scripts, and data sharing.

Convert DB to JSON online - free

Uploading…
Selected files exceed the 150 MB total limit. Please select fewer or smaller files.

Your file is processed instantly and never stored on our servers.

How to convert db to json file

A web API, JavaScript application, or data-sharing tool may require records as JSON instead of a database file. Converting creates an interoperable text export, but the correct method depends on the database engine behind the .db extension.

What the DB format is

DB is not one specific format. It is a generic filename extension used by SQLite applications, mobile apps, games, browsers, desktop programs, and proprietary database systems. A database file may contain tables, indexes, relationships, constraints, triggers, and metadata managed by its engine.

SQLite commonly uses .db, .sqlite, or .sqlite3. Its files normally begin with the signature SQLite format 3 and can be opened with DB Browser for SQLite, the SQLite command-line shell, or Python's built-in sqlite3 module. Microsoft Access databases normally use .mdb or .accdb and require Access or an Access-compatible driver. Proprietary DB files may only open in the software that created them.

Identify the database engine before choosing a converter. Renaming the extension does not change the format and cannot make an incompatible file readable.

What the JSON format is

JSON (JavaScript Object Notation) is a UTF-8 text format built from objects, arrays, strings, numbers, Boolean values, and null. Web APIs, JavaScript programs, configuration tools, scripts, and many data-processing systems can read it without a database driver.

A relational table is commonly exported as an array of objects, with one object per row:

[{"id":1,"name":"Ada"},{"id":2,"name":"Linus"}]

JSON is readable and easy to exchange, but it is not a database. It does not retain indexes, constraints, triggers, transactions, or foreign-key behavior. JSON is not automatically smaller than the source database; use compression such as gzip when transfer size matters.

How to convert a DB file to JSON

First, make a copy of the original file. Then identify its engine and decide whether the output should contain one table, multiple tables, or joined and nested records. Exporting every table independently does not preserve relationships.

For a supported file, the simplest option is to use the free converter on 101convert.com: upload the DB file, select JSON as the output format when available, start the conversion, and download the resulting file. Support depends on the database engine, file size, encryption, and password requirements; do not upload confidential records unless the service's handling and retention policies are acceptable.

For SQLite, DB Browser for SQLite provides a graphical export. Open the file, inspect the schema, select the required table, and use File → Export → Table(s) as JSON if that command is available in the installed version. Export only the required tables or query results, then open the output with a JSON validator or parser.

Python provides repeatable filtering, renaming, and multi-table exports. Save this as export_db.py beside input.db and run python export_db.py:

import json
import sqlite3

with sqlite3.connect("input.db") as db:
    db.row_factory = sqlite3.Row
    names = db.execute(
        "SELECT name FROM sqlite_master "
        "WHERE type = 'table' AND name NOT LIKE 'sqlite_%' ORDER BY name"
    ).fetchall()
    output = {}
    for (name,) in names:
        quoted = '"' + name.replace('"', '""') + '"'
        rows = db.execute(f"SELECT * FROM {quoted}")
        output[name] = [dict(row) for row in rows]

with open("output.json", "w", encoding="utf-8") as file:
    json.dump(output, file, ensure_ascii=False, indent=2)

The resulting file has one property per table, such as {"users":[...],"orders":[...]}. For a targeted export, replace the SELECT * query with a query that selects specific columns, filters rows, or joins related tables. Do not use untrusted strings to construct SQL identifiers without proper quoting.

The SQLite command-line shell is suitable for a single query. Run:

sqlite3 input.db
.mode json
.once output.json
SELECT id, name, email FROM users WHERE active = 1;
.once stdout
.quit

The query result is written as a JSON array. The shell's JSON mode requires a sufficiently recent SQLite version; check the installed shell if the command is unavailable.

For Access or another engine, open the file with its native application or official driver, select a table or query, and export the result. If the application produces CSV rather than JSON, serialize the CSV with a script while preserving headers, quoting, null values, and character encoding. For recurring exports, query the database through its official driver using Python, JavaScript, C#, or the vendor's command-line tools.

Quality and compatibility checks

  • Relationships: separate tables remain separate unless SQL joins or application code create nested objects. Foreign keys and relational constraints are not reproduced by ordinary JSON.
  • Types: dates, decimal values, UUIDs, database-specific types, and nulls need an agreed representation. Use ISO 8601 for dates and a documented decimal strategy. JSON has no native date, decimal, or binary type.
  • Binary data: blobs usually require Base64 or another agreed encoding, which increases size. Some converters may omit or reject blob values.
  • Special values: standard JSON cannot represent NaN, infinity, or arbitrary binary data directly.
  • Large exports: building one in-memory JSON object can exhaust memory. Stream rows, export tables separately, or use newline-delimited JSON (NDJSON) when the receiving program supports it.
  • Encoding: write UTF-8 JSON. In Python, ensure_ascii=False keeps non-ASCII characters readable instead of escaping them.
  • Validation: parse the result with a JSON parser and compare row counts, key fields, nulls, dates, and numeric values with the source. A file that looks readable may still contain truncated or incorrectly typed data.
  • Security: remove passwords, tokens, personal data, and internal metadata before sharing an export. Encrypted or password-protected databases generally must be opened and decrypted by their native software first.

Frequently asked questions

Is the DB to JSON converter free?

Yes, converting DB to JSON on 101convert.com is completely free. No registration, email address or installation is required.

How large can my DB file be?

You can upload DB files up to 50 MB and convert up to 20 files at once in a single batch.

What happens to my uploaded files?

Files are processed automatically and deleted from our servers within a few minutes after conversion. We never view or share your files.

Do I need to install any software to convert DB to JSON?

No. The DB to JSON conversion runs entirely online in your browser and works on Windows, Mac, Linux, Android and iPhone.

Did the conversion fail?

In most cases, the cause is an incorrect file format. Please upload a valid DB file for this DB to JSON conversion. Occasionally, the issue may be on our side. We analyze recurring conversion failures and disable or fix the converter if we detect a defect.