CSV to Array
Turn a CSV into a literal you can paste directly into code — a test fixture, a seed script, a lookup table, a Storybook mock. Pick your language, name the variable, and get properly escaped and indented output with numbers as numbers instead of quoted strings.
How to convert CSV to an array
- Paste the CSV or drop a file.
- Choose the output language and shape — objects keyed by header, or plain positional rows.
- Name the variable as you want it in your file.
- Copy the result and paste it into your code.
Objects or 2D rows?
Array of objects is what you usually want: each row is keyed by the header name, so the code reads row.email and doesn't break when a column moves. Keys that aren't valid identifiers are quoted automatically. 2D arrays are more compact and preserve column order — better for a table you're going to render positionally, or for a fixture that's compared against a CSV somewhere else. The 2D form includes the header as its first row so the data stays self-describing.
Escaping and typing
Strings are escaped per language: JSON.stringify rules for JavaScript, Python, and Ruby, and single-quoted escaping for PHP. Type detection turns 42 into a number, true/false into a boolean, and null/nil into the language's null — while leaving 007 and other leading-zero values as strings, because those are identifiers, not numbers. Turn detection off when every value must stay a string.
FAQ
Is this valid, runnable code?
The literal is — it's a complete assignment statement ready to paste. You'll still add your own import, export, or wrapping as needed.
Can I get TypeScript types too?
Not directly. The JS object output works as-is in TypeScript; for a type, generate a schema with JSON Schema and convert that.
Why is my ID quoted?
Because it has a leading zero or a symbol, so treating it as a number would change its value. That's deliberate.
Is anything uploaded?
No. It runs in your browser.
Privacy
100% client-side. No upload. See the privacy policy.