CSV and JSON Converter
Convert CSV rows to JSON and JSON arrays to CSV.
What Is a CSV and JSON Converter?
A CSV and JSON converter changes tabular CSV records into structured JSON data or turns suitable JSON records into spreadsheet-friendly CSV text. In a typical CSV-to-JSON conversion, column headers become object keys and each data row becomes a JSON object. Converting the other way creates columns from JSON properties. It is useful when moving data between spreadsheets, databases, scripts, and APIs, but you should check quoting, missing values, and data types before importing the result.
CSV and JSON Converter
Convert CSV rows to JSON and JSON arrays to CSV.
Move Data Between CSV Tables and JSON Records Without Losing Meaning
A spreadsheet export and an API response can contain the same customer records yet represent them very differently. CSV organizes information into rows and columns. JSON describes values using arrays, objects, property names, and data types. Converting between them is straightforward for simple tables, but details such as quoted commas, blank cells, and leading zeros can change the meaning of your data.
Use the converter above with the input and conversion options available in its current interface, then review the output before putting it into a website, script, or import system. This guide walks through both directions with realistic samples. It explains what a clean conversion should look like, why nested JSON needs special treatment, and how to recognize errors before they reach a production workflow. The examples below illustrate general CSV and JSON behavior; they are not results from a live test of this particular WordPress tool.
Read Full GuideShow Less
Why CSV and JSON Represent the Same Data Differently
CSV (comma-separated values) is a text format for tables. Rows usually appear on separate lines and fields are separated by commas. The first row often contains headers, although not every CSV file has one. JSON (JavaScript Object Notation) represents data through named objects, ordered arrays, strings, numbers, booleans, and null.
| Feature | CSV | JSON |
|---|---|---|
| Typical structure | Rows and columns | Objects, arrays, and values |
| Column or field names | Optional header row | Object property names |
| Data types | Textual fields without native type markers | Strings, numbers, booleans, null, arrays, objects |
| Nested records | No native nested structure | Objects and arrays can be nested |
| Common use | Spreadsheet and database exports | APIs, configuration, and software data exchange |
Neither format is universally better. The right choice depends on where the data goes and whether relationships and types need to be preserved.
Worked Example: Turn a CSV Export into JSON Objects
Consider a short product inventory exported from a spreadsheet. Its first row contains three headers, and the second product name contains a comma. In correctly formed CSV, that name is enclosed in double quotes.
sku,name,price
00125,Desk Lamp,18.50
00126,"Notebook, A5",4.25
A common header-based CSV-to-JSON mapping produces an array of two objects:
[
{"sku":"00125","name":"Desk Lamp","price":"18.50"},
{"sku":"00126","name":"Notebook, A5","price":"4.25"}
]
The example deliberately keeps all CSV values as JSON strings. CSV itself does not say whether 18.50 should become a number or whether 00125 is an identifier. If a converter offers automatic type detection, inspect the result: a number conversion could remove the SKU’s leading zeros. Never assume that a field should be numeric simply because it contains digits.
How to Convert CSV to JSON Carefully
- Inspect the source columns. Check whether the first row contains field names and whether each subsequent record uses the same number of columns.
- Check the separator. A comma is typical, but some exports use semicolons or tabs. Select an appropriate delimiter only if the interface supports that setting.
- Enter your source. Paste the CSV text or use a file input where one is offered. Do not assume file upload is supported without checking the interface.
- Run the available conversion. Review whether the output is an array of objects or another structure.
- Verify representative rows. Compare names containing commas, blank fields, identifier strings, and the last record against the original.
- Validate before importing. A readable JSON result may still contain unexpected types or mismatched field names.
Use the JSON Formatter and Validator as a relevant follow-up if you need to inspect the JSON syntax independently.
How JSON Records Become CSV Columns
For JSON-to-CSV conversion, the easiest input is an array of flat objects whose properties describe consistent fields. For example:
[
{"name":"Maya","city":"Lahore","active":true},
{"name":"Ali","city":"Karachi","active":false}
]
One reasonable CSV representation is:
name,city,active
Maya,Lahore,true
Ali,Karachi,false
Here the JSON booleans become textual CSV field values. When the file is opened in a spreadsheet or reimported elsewhere, another application may interpret them differently. Also check which object supplies column names. If later objects contain additional properties, a converter that only reads the first object’s keys may omit those fields. Verify the output headers rather than assuming that all properties are included.
CSV Quoting Rules Prevent Broken Rows
CSV is more than text split on commas. A field may contain a comma, a quotation mark, or a line break. Under the common RFC 4180 conventions, such a field is enclosed in double quotes; a literal double quote inside a quoted field is represented by two double quotes.
item,notes
Book,"Includes charts, maps, and photos"
Poster,"Customer said ""Please keep flat"""
In this example, the embedded comma and quotation marks belong to field values. Splitting each line at every comma would corrupt the first record. Splitting at every newline could also break a quoted multiline field. A properly implemented CSV parser handles these cases as records rather than blindly separating characters. If the output looks shifted, inspect quoting before editing headers or discarding rows.
Headers, Blank Cells, and Duplicate Names Need Attention
Header-based conversion depends on meaningful, distinct column names. A blank header may produce an empty key or a tool-specific substitute. Duplicate headers such as price,price cannot be represented reliably as two different values under a single JSON object key. JSON’s interoperability guidance recommends unique object member names.
Missing values are another important distinction. An empty CSV field might mean an empty string, an unknown value, or data intentionally left blank. JSON can represent "" and null, but they are not interchangeable. Decide what blank cells mean in your dataset and inspect how your particular converter maps them. The same applies in reverse: a missing property and a property explicitly set to null may produce visually similar CSV cells even though they represent different states.
Preserve IDs, Dates, and Long Numbers
Product SKUs, postal codes, telephone numbers, account identifiers, and order references often contain digits but are identifiers rather than quantities. Keep them as strings when possible. Turning 000482 into the number 482 removes information. Large integers can also lose precision in software that uses limited-precision numeric representations.
Dates deserve the same scrutiny. A CSV date such as 06/11/2026 can be interpreted differently across regions. An explicit format such as 2026-11-06 is generally clearer, but JSON does not define a native date type: dates are commonly transmitted as strings with an agreed format. Conversion does not automatically make an ambiguous date unambiguous.
What Happens to Nested JSON?
Consider a JSON record containing a customer object, a list of tags, and an order amount. CSV has no built-in way to store that nested structure as independent hierarchy. A converter might flatten the keys into column names such as customer.name, serialize arrays as JSON text in a cell, or decline to convert unsupported structures. These are design choices, not universal conversion rules.
Before exporting nested JSON for a spreadsheet, decide whether you need one row per customer, one row per order, or one row per line item. Flattening is appropriate when the relationship is clear. Otherwise, separate tables linked by an ID may represent the original data more faithfully. A one-click conversion cannot replace that data-model decision.
Interpret Conversion Errors Instead of Guessing
| Unexpected result | Likely explanation | What to inspect |
|---|---|---|
| Fields shift into other columns | Unquoted comma or wrong delimiter | Quoted fields and separator settings |
| JSON fails validation | Malformed JSON syntax or escaping | Quotes, commas, brackets, and control characters |
| Leading zeros vanish | Automatic numeric conversion | Identifier data types before export |
| Repeated columns disappear | Duplicate header or object key | Uniqueness of field names |
| Rows appear incomplete | Inconsistent field count or embedded newline | Original CSV records and quoting |
| Unexpected blank values | Missing keys, null values, or empty strings | Schema and missing-value handling |
| Nested fields become text | Flat CSV cannot natively encode objects | Flattening or serialization strategy |
For source tables with inconsistent column counts, a dedicated CSV Structure Validator is a useful next step. For issues involving invisible characters in a header, inspect the text with the Unicode and Invisible Character Inspector.
Check Data Safety Before Sharing an Export
CSV or JSON content may include customer details, addresses, internal URLs, or business records. Do not paste confidential material into an online service unless its processing and retention behavior are verified and suitable for your policies. The presence of a text box alone does not prove that processing stays in your browser.
Spreadsheet applications introduce a separate concern: CSV formula injection. When untrusted cell content begins with characters such as =, +, -, or @, some spreadsheet software may treat it as a formula when opening an exported CSV. Conversion is not the same as security sanitization. If the output will be opened in a spreadsheet, use the appropriate export safeguards and test them in that spreadsheet environment.
Questions About CSV and JSON Conversion
Can I convert a CSV file to JSON without changing its values?
Usually, if the mapping preserves fields as strings and parses CSV quoting correctly. Still compare the output with the original, especially for empty fields, unusual characters, and leading-zero identifiers.
Does JSON always convert cleanly into a spreadsheet?
No. Flat arrays of objects map naturally to rows and columns. Nested objects, arrays, and records with differing keys may require a deliberate flattening strategy.
Why do numbers become quoted strings in JSON?
CSV fields do not declare their own types. Keeping values as JSON strings is a conservative conversion choice. Numeric inference is possible, but it can damage identifiers or introduce ambiguity.
Can CSV contain commas and line breaks inside a field?
Yes. Properly quoted CSV fields can include both. An embedded double quote must be escaped as two double quotes under common CSV conventions.
Is a successful conversion proof that the data is correct?
No. Valid syntax only proves that the result follows the expected format. Check record counts, column names, important values, and the requirements of the system receiving the data.