Chuyển SQL sang JSON

Cần chuyển đổi ngược không?
JSON to SQL Converter

Đầu vào: SQL

1

Đầu ra: JSON

Nhập dữ liệu SQL để chuyển đổi sang JSON

Dữ liệu đã chuyển đổi sẽ hiển thị ở đây

Cách chuyển SQL sang JSON

  1. Bước 1 – Dán INSERT SQL

    • Dán các câu INSERT INTO ... VALUES ...; từ dump hoặc export SQL của bạn.
    • Công cụ hỗ trợ nhiều câu INSERT, phân tách bằng dấu chấm phẩy.
    • Bạn cũng có thể import file .sql từ máy tính.
  2. Bước 2 – Kiểm tra chuyển đổi

    • Công cụ parse cú pháp SQL, lấy tên cột làm key và giá trị làm data.
    • Integer, boolean (TRUE/FALSE) và NULL được chuyển sang tương đương JSON.
    • Mỗi bản ghi có trường _table cho biết bảng nguồn.
  3. Bước 3 – Xuất JSON

    • Sao chép mảng JSON đã format để dùng cho API hoặc file cấu hình.
    • Tải xuống kết quả dưới dạng file .json.
    • Nếu cần đảo chiều, dùng công cụ liên quan để chuyển JSON về SQL.
Example: SQL to JSON
// Input SQL
INSERT INTO users (id, role) VALUES (1, 'admin');

// Output JSON
[
  {
    "id": 1,
    "role": "admin",
    "_table": "users"
  }
]

Related tools

Câu hỏi thường gặp

What SQL statements are supported?

Currently supports INSERT INTO statements with a VALUES clause. Each INSERT statement becomes a JSON object with column names as keys and the table name stored in a _table field.

How are SQL data types converted?

NULL → null, quoted strings → strings, numbers → numbers, TRUE/FALSE → booleans. Complex values are treated as strings and may need additional parsing.

Can I process multiple INSERT statements?

Yes. The converter processes all INSERT statements in the input and creates an array of JSON objects, one for each INSERT statement.

What about other SQL statements?

Currently only INSERT statements are supported. CREATE TABLE, SELECT, UPDATE, and DELETE statements are not processed but won't cause errors.

Is my data secure?

Yes, all data processing happens entirely in your browser. Your data is never sent to any server, ensuring complete privacy and security.

Chuyển SQL sang JSON | JSONSwiss