Key Takeaways
The CSV occupies five physical lines but contains three data records. Forward conversion must return three objects with three string fields each; Amount is "12.50", "" and "0". Parse the reverse CSV and compare all nine values. Changed line endings or quoting style alone do not establish changed data.
In this article
Complete input: comma, embedded newline and double quotes together
Download source.csv or copy the entire block. ID,Note,Amount is the only header. The first note contains a comma, the second a real newline and the third double quotes. These are fictional records; amounts remain text in this converter.
- Open CSV/JSON conversion, paste the whole input and run forward conversion. Do not split records on newlines or replace the note’s comma first.
- Compare the three objects with the complete reference JSON. Check full IDs, newline/quote content and the three Amount strings, rather than accepting a success message alone.
- Download or copy the JSON and retain the CSV. If the source uses semicolons or another encoding, first inspect it through the CSV import/type workflow; this text converter expects comma-separated CSV.
ID,Note,Amount
0007,"First, then check",12.50
0008,"Line one
Line two",
0009,"He said ""OK""",0[
{
"ID": "0007",
"Note": "First, then check",
"Amount": "12.50"
},
{
"ID": "0008",
"Note": "Line one\nLine two",
"Amount": ""
},
{
"ID": "0009",
"Note": "He said \"OK\"",
"Amount": "0"
}
]RFC 4180’s CSV description explains quoting for commas, newlines and double quotes. Byte identity, formatting and type preservation are separate acceptance questions.
Reverse conversion: compare parsed values, not identical bytes
Put the complete forward result back into the input and run reverse conversion. The tool requires a nonempty flat array of objects. Expand nested objects/arrays according to their meaning instead of deleting fields merely to pass validation.
- Retain this JSON, generate/download reverse CSV, then run that CSV forward again to obtain a second JSON copy.
- Match the records by ID:0007 keeps First, then check;0008 keeps one newline and an empty Amount;0009 keeps "OK" and string 0.
- The field set must remain ID,Note,Amount with three fields in every object. Key order or CSV line endings may change; this exercise accepts equality of parsed records and values.
| ID | Note check | Amount check |
|---|---|---|
| 0007 | Comma stays within Note | String 12.50 |
| 0008 | One real newline between Line one and Line two | Empty string |
| 0009 | He said "OK" retains its quotes | String 0 |
CSV does not carry every JSON type distinction. An absent key, null and empty string can collapse into an ordinary blank cell. Use the explicit state-column method below when these states matter, rather than guessing from a blank.
Why five physical lines contain only three data records
There is one header line, one first-record line, two lines for the second record and one final-record line: five physical lines. Quoting determines record boundaries, so a newline split is not a record count.
| Structure | Count | Check |
|---|---|---|
| Header | 1 | ID,Note,Amount column names |
| Data records | 3 | Three JSON objects and three IDs |
| Field values | 9 | Three records×three columns, including an empty string |
| Embedded note newline | 1 | Part of 0008, not a fourth record |
Add a state column when missing and explicitly empty differ
Suppose illustrative JSON record A has phone: null, B has no phone property, and C has phone: "". All three export to blank phone cells in CSV. Converting back cannot recover which original state each blank represented. This is a loss of structure, not something repeated conversion can repair.
If the distinction matters, prepare a flat schema with id, phone and phone_state before conversion. Give A the state explicit_null, B missing and C empty_string. This is a convention you define and explain to the recipient, not a field generated automatically by the converter. The recipient can reconstruct meaning from the state. When the distinction does not matter, accepting blanks avoids unnecessary extra fields.
| Source | phone | phone_state |
|---|---|---|
| {"id":"A","phone":null} | "" | explicit_null |
| {"id":"B"} | "" | missing |
| {"id":"C","phone":""} | "" | empty_string |
Repair the structural cause, then review the complete records
For a “4 fields; header has 3” error, locate that logical record first. If the source is 0007,Ada,red, blue and red, blue is one note, enclose that note instead of deleting its comma and changing the wording. For an id,id,note header, establish distinct meanings and names for the two identifier columns. Merely deleting one header leaves later values without their intended positions.
An unclosed quote requires checking where the source field actually ends. Appending a quote to the end of a file can make several orders appear to be one large note. After repair, compare the expected ID set, record count and first and last notes to establish that structure was restored without rewriting content.
Repair structure, then accept the complete round trip
The pack’s bad-width.csv puts 0008,unquoted, comma,0 under three headers: four fields, so the current converter must reject it. If the intended note is unquoted, comma, repair the row as 0008,"unquoted, comma",0. Removing the comma may restore width while changing the original note.
Three-record handoff acceptance
- Preserve all three IDs character for character;0007 stays 0007, with no added or missing field.
- Keep the comma, one embedded newline and "OK" in their own notes.
- Amount remains string 12.50, empty string and string 0 without an invented numeric/null conversion.
- Reparse the returned CSV and compare all nine values with the answer; keep the original and correction record.
A calculation-ready workbook needs separate type decisions. Continue with JSON-to-Excel ID and calculation-column checks rather than assuming structural conversion validates monetary or identifier types. For notices, confirm variables and source columns using the Word template workflow.
Common questions
Does it support nested JSON?
JSON to CSV here rejects object or array field values. Expand the required fields into named columns first.
Are null and missing fields kept distinct?
No. Both become empty CSV cells in this conversion. Add a status column when the difference matters.
Can I upload Excel directly?
This entry accepts pasted text. Export Excel as CSV in a spreadsheet tool, then review and convert the text.
Further reading & sources
Put the guide into practice
Open the relevant tool, preview the result and check your exported file.


