Chuyển tới nội dung chính
Z

CSV vs JSON

CSV vs JSON compared — structure, nesting, size and tooling, plus free converters between CSV and JSON.

CSV is a flat, tabular format that spreadsheets and data tools love; JSON is a nested, typed format that code loves. CSV wins for rows-and-columns data; JSON wins when records have nested or varying structure.

CSV vs JSON at a glance

CSV JSON
Structure Flat table (rows × columns) Nested objects & arrays
Types Everything is text Strings, numbers, bool, null
Size Very compact Larger (keys repeated)
Tooling Excel, Sheets, pandas APIs, JS, databases
Nesting Not supported First-class

When to use CSV

Choose CSV for tabular data destined for spreadsheets or data analysis, and for the smallest possible export of flat records.

When to use JSON

Choose JSON when records nest, types matter, or the data feeds an API or application.

Tools for CSV & JSON

CSV vs JSON

Nếu tiêu đề của tôi có khoảng trắng hoặc ký tự đặc biệt thì sao?

Chúng sẽ được thay bằng dấu gạch dưới, vì tên phần tử XML không được chứa các ký tự đó. Tiêu đề bắt đầu bằng chữ số sẽ được thêm tiền tố `_`.

Cần cấu trúc XML khác (dùng thuộc tính thay vì phần tử con)?

Hãy chuyển CSV sang JSON trước bằng <a class="text-brand-600 hover:underline" href="/csv-to-json">CSV to JSON</a>, chỉnh sửa JSON, sau đó dùng <a class="text-brand-600 hover:underline" href="/json-to-xml">JSON to XML</a> với tiền tố thuộc tính (attribute prefix).

Tôi có thể định dạng đẹp (pretty-print) kết quả hơn nữa không?

Kết quả đầu ra đã được thụt lề sẵn. Hãy dùng <a class="text-brand-600 hover:underline" href="/xml-formatter">XML Formatter</a> nếu bạn cần thụt lề khác hoặc muốn rút gọn (minify).