JSON Repair Tool and Invalid JSON Recovery Assistant

Đầu vào: JSON bị lỗi

1

Đầu ra: JSON đã sửa

Cài đặt

Cách sửa JSON hoạt động

Khi bạn nhập JSON không hợp lệ, hệ thống sẽ tự động thử các phương pháp sau theo thứ tự:

1
Thư viện JSONRepair
Sửa nhanh và chính xác cho phần lớn lỗi phổ biến
2
Sửa cơ bản theo mẫu
Xử lý lỗi cú pháp đơn giản
3
Nhà cung cấp AI
AI và các lựa chọn khác cho trường hợp phức tạp

Bắt đầu sửa JSON

Nhập JSON bị lỗi, hoặc bấm Nhập để tải từ tệp.

Hướng dẫn từng bước: Cách sửa JSON bị lỗi

1Bước 1 – Dán JSON bị lỗi của bạn2Bước 2 – Quy trình sửa tự động3Bước 3 – Xem lại JSON đã sửa4Bước 4 – Sử dụng JSON sạch

Repair JSON works best between validation and formatting. Start with the raw broken payload, let the tool try deterministic local repair first, use AI-assisted repair only if needed, then move the recovered JSON into validation, formatting, or export.

Recover broken text into usable JSON

Repair JSON is most valuable when the payload is too broken to use anywhere else

A lot of broken JSON is not just ugly - it is completely unusable. The repair step matters because it gets that payload back into a valid JSON shape so validation, formatting, comparison, and export are possible again.

Broken input
1
{
2
name: "Project X",
3
'id': 1024,
4
items: [
5
"A",
6
"B",
7
]
8
}
Repaired output
1
{
2
"name": "Project X",
3
"id": 1024,
4
"items": [
5
"A",
6
"B"
7
]
8
}

If the JSON is too broken to parse at all, starting with Repair JSON is often faster than starting with manual validation.

3 repair examples that reflect real workflows

Repair JSON is usually used for messy real-world payloads, not classroom examples. These examples match common issues in legacy systems, config cleanup, and corrupted logs.

Legacy API

Fix missing quotes and mixed quoting styles quickly

Useful for old systems, script-generated payloads, or manually assembled responses that almost look like JSON but are not actually valid.

JSON bị lỗi
1
{
2
orderId: 'SO-1024',
3
customer: {
4
name: 'Maeve'
5
}
6
}
JSON đã sửa
1
{
2
"orderId": "SO-1024",
3
"customer": {
4
"name": "Maeve"
5
}
6
}

This category is usually fixed by local repair alone, without needing AI.

Config Cleanup

Strip comments and trailing commas so config parses again

Teams often write JavaScript object style config and only realize later that strict JSON does not allow comments or trailing commas.

JSON bị lỗi
1
{
2
"env": "prod",
3
"retry": 3, // retry count
4
"features": {
5
"betaCheckout": false,
6
}
7
}
JSON đã sửa
1
{
2
"env": "prod",
3
"retry": 3,
4
"features": {
5
"betaCheckout": false
6
}
7
}

Repair JSON is ideal for pulling almost-JSON config back into a strict JSON form.

Complex Logs

Use AI only when deterministic repair is not enough

When a payload includes truncation, escape damage, and multiple bracket errors at once, deterministic local rules may not be enough. That is where AI repair becomes useful.

JSON bị lỗi
1
{"event":"checkout","user":{"id":42,"name":"Maeve"},"items":[{"sku":"A-1","qty":2},{"sku":"B-8","qty":1],"status":"paid"
JSON đã sửa
1
{
2
"event": "checkout",
3
"user": {
4
"id": 42,
5
"name": "Maeve"
6
},
7
"items": [
8
{
9
"sku": "A-1",
10
"qty": 2
11
},
12
{
13
"sku": "B-8",
14
"qty": 1
15
}
16
],
17
"status": "paid"
18
}

After this kind of repair, validate the result again before trusting it in downstream workflows.

  1. 01

    Tutorial Step

    Bước 1 – Dán JSON bị lỗi của bạn

    The repair tool needs the original context more than a half-cleaned version. Logs, old API responses, and broken config files are often easier to repair when you keep the raw text intact instead of manually deleting large sections first.

    • Sao chép JSON không hợp lệ hoặc bị lỗi (ví dụ từ log, API cũ hoặc tệp cấu hình).
    • Dán vào panel editor bên trái. Bạn cũng có thể kéo‑thả tệp hoặc dùng nút Nhập.
    • Đừng lo về lỗi như key thiếu dấu ngoặc kép hay dấu phẩy ở cuối—công cụ này được thiết kế để sửa chúng.
    • If the validator already showed a long list of syntax failures, switching here usually saves more time than fixing them one by one.
    • Keeping the raw payload intact gives both local repair and AI repair a better shot at reconstructing the intended structure.
  2. 02

    Tutorial Step

    Bước 2 – Quy trình sửa tự động

    Not every repair uses AI. Most broken JSON is fixed by deterministic local rules, so the real goal here is to understand the repair order instead of assuming every issue needs an AI rewrite.

    • Nếu JSON không hợp lệ, nút “Sửa” sẽ xuất hiện (hoặc bạn có thể bấm thủ công).
    • Công cụ sẽ thử sửa cục bộ nhanh để xử lý lỗi cú pháp ngay lập tức.
    • Nếu sửa cục bộ chưa đủ, hệ thống sẽ chuyển sang sửa bằng AI để suy luận ý định và sửa cấu trúc.
    • The progress indicator helps you see whether the page is doing local repair, AI repair, or final validation of the repaired result.
    • If the input is too large for AI repair, split it into smaller logical chunks instead of retrying the same oversized payload.
  3. 03

    Tutorial Step

    Bước 3 – Xem lại JSON đã sửa

    A successful repair is not only about making the JSON parse again. You also need to confirm that the result still matches the intended business structure, especially for nested objects, arrays, and partially corrupted logs.

    • JSON đã sửa và hợp lệ sẽ xuất hiện ở panel bên phải.
    • Chúng tôi tự động pretty‑print để bạn kiểm tra cấu trúc và giá trị.
    • Xem chỉ báo hợp lệ để đảm bảo JSON đã tuân theo cú pháp chuẩn.
    • If the repaired result still looks suspicious, return to the validator or original source instead of pushing it downstream blindly.
    • For logs and configuration, pay special attention to booleans, numbers-as-strings, and datetime fields after repair.
  4. 04

    Tutorial Step

    Bước 4 – Sử dụng JSON sạch

    Repair is the recovery step, not the final destination. Once the JSON is usable again, you should immediately move it into the right next tool depending on whether you need validation, readability, schema generation, or field-level review.

    • Bấm Copy để sao chép JSON đã sửa vào clipboard.
    • Tải xuống dưới dạng tệp `.json` để sao lưu.
    • Dùng Apply để đưa kết quả về phía input nếu bạn muốn chỉnh sửa thủ công thêm.
    • If you need row-and-column review, filtering, or bulk edits, continue into the table editor.
    • If the repaired JSON is now stable, it is also a much better input for schema generation, type generation, and transformation steps.

A more reliable repair workflow

1

Paste the raw broken JSON into Repair JSON before doing broad manual cleanup.

2

Let local repair run first and use that result when it is enough, rather than forcing every case through AI.

3

If the structure is still too broken, split the payload or let AI repair handle the more complex reconstruction.

4

Validate the repaired output next, then move it to the formatter, table editor, or schema tools depending on your goal.

5

If the result matters for team review or rollback, download the repaired version instead of only copying it to the clipboard.

Repair JSON is most useful not because it saves one comma fix, but because it recovers data that would otherwise be blocked from the rest of your JSON workflow.

Practical repair tips

If the payload only has a few syntax problems, repair is fast. If large sections are missing, repair can recover syntax but not invent the original business data.
For very large payloads, split the JSON into logical chunks before repair. Success rates are usually better that way.
Do not ship or store the repaired result blindly. Validate it first, then decide whether it also needs formatting.
If you need to inspect fields one by one after repair, the table editor is often easier than scanning a long JSON blob.

Công cụ JSON liên quan

  • Sau khi sửa, bạn có thể muốn định dạng, kiểm tra hoặc chuyển đổi dữ liệu.

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

Sửa JSON hoạt động như thế nào?

Hệ thống sửa của chúng tôi dùng cách tiếp cận nhiều lớp: trước hết là thư viện JSONRepair để sửa nhanh và ổn định, tiếp theo là các sửa chữa cơ bản theo mẫu, và cuối cùng là nhà cung cấp AI (AI, OpenRouter, Groq) cho những lỗi phức tạp.

Dữ liệu của tôi có an toàn không?

Có. Tất cả sửa cục bộ (thư viện JSONRepair và sửa theo mẫu) đều diễn ra hoàn toàn trong trình duyệt. Chúng tôi không lưu trữ dữ liệu của bạn. Nếu bạn dùng sửa bằng AI cho các trường hợp phức tạp, JSON sẽ được gửi tới nhà cung cấp AI (AI) chỉ để xử lý và không được lưu trữ hay dùng để huấn luyện.

Những phương pháp sửa nào được sử dụng?

1) Thư viện JSONRepair — sửa nhanh và chính xác cho phần lớn lỗi phổ biến. 2) Sửa cơ bản — sửa theo mẫu cho lỗi cú pháp đơn giản. 3) Sửa bằng AI — AI và các nhà cung cấp AI khác cho vấn đề cấu trúc phức tạp.

Có thể sửa thiếu dấu ngoặc kép hoặc dấu phẩy không?

Có. Các lỗi thường gặp như key thiếu dấu ngoặc kép, dấu phẩy thừa ở cuối, thiếu dấu phẩy giữa các phần tử và ngoặc không khớp sẽ được công cụ sửa cục bộ tự động xử lý.

Sửa bằng AI có giới hạn kích thước không?

Có. Để đảm bảo ổn định, sửa bằng AI hỗ trợ đầu vào tối đa khoảng (~18000 ký tự) mỗi lần. JSON lớn hơn thường có thể sửa bằng JSONRepair/sửa cơ bản, hoặc bạn có thể chia nhỏ trước khi dùng AI.

Tôi có cần API key không?

Không. Bạn không cần API key. Với trường hợp phức tạp, chúng tôi nâng cao kết quả bằng tích hợp AI API (do chúng tôi quản lý) bên cạnh sửa cục bộ và các sửa chữa tích hợp sẵn—dùng được ngay.

Độ chính xác của quá trình sửa như thế nào?

Rất cao với lỗi phổ biến nhờ thư viện JSONRepair. Sửa cơ bản xử lý lỗi cú pháp đơn giản. Khi cần, nhà cung cấp AI sẽ phân tích thông minh để xử lý các vấn đề cấu trúc phức tạp.

When should I stop auto-repairing and fix the JSON by hand?

If large sections of the payload are missing, truncated, or business meaning depends on context only you know, automatic repair can only recover syntax, not your original intent. In that case, combine validator diagnostics with manual fixes.