User Rating 0.0 ā˜…ā˜…ā˜…ā˜…ā˜…
Total Usage 0 times
Drop CSV file here
Output
Output will appear here...
Is this tool helpful?

Your feedback helps us improve.

ā˜… ā˜… ā˜… ā˜… ā˜…

About

Malformed CSV parsing causes silent data corruption. A missing escaped quote shifts every subsequent column, propagating errors across thousands of rows. This tool implements a finite-state-machine parser compliant with RFC 4180, handling quoted fields, embedded delimiters, escaped double-quotes (""), and newlines within cells. It infers types - distinguishing NULL, booleans, integers, and floats from strings - then serializes each row into syntactically valid array literals for 10 programming languages. The parser processes input in O(n) time where n is total character count. Note: type inference assumes decimal number formatting (period as separator). Locale-specific formats like 1.234,56 require pre-processing.

csv to array csv converter csv parser code generator data conversion array formatter

Formulas

The CSV parser operates as a finite-state machine with 4 states, processing each character c in the input stream:

{
S0 = FIELD_START → if c = " then S1, else S2S1 = IN_QUOTED → if c = " then S3, else append cS2 = IN_UNQUOTED → if c = delim then emit field, go S0S3 = QUOTE_IN_QUOTED → if c = " then append ", go S1

Type inference applies pattern matching per field value v:

{
type(v) = Integer if v ∈ /^-?\d+$/type(v) = Float if v ∈ /^-?\d+\.\d+$/type(v) = Boolean if v ∈ /^(true|false)$/itype(v) = NULL if v ∈ /^(null|nil|none|)$/itype(v) = String otherwise

Where v is the trimmed field value after CSV parsing, and delim is the user-selected delimiter character.

Reference Data

LanguageArray SyntaxString QuoteNull LiteralBoolean FormatTrailing Comma
JavaScript[...]Double "nulltrue / falseAllowed
Python[...]Double "NoneTrue / FalseAllowed
PHParray(...) or [...]Single 'nulltrue / falseAllowed
Ruby[...]Double "niltrue / falseAllowed
Javanew String[]{...}Double "nulltrue / falseNot allowed
C#new []{...}Double "nulltrue / falseAllowed
Go[]interface{}{...}Double "niltrue / falseRequired
Swift[...]Double "niltrue / falseAllowed
Rustvec![...]Double "Nonetrue / falseAllowed
JSON[...]Double "nulltrue / falseNot allowed
Common CSV Delimiters
Comma, - RFC 4180 default. Most common in US/UK locale exports.
Semicolon; - Default in European Excel exports where comma is decimal separator.
Tab\t - TSV format. Common in database exports and clipboard paste from spreadsheets.
Pipe| - Used when field data contains commas and semicolons frequently.

Frequently Asked Questions

Per RFC 4180, fields enclosed in double quotes may contain line breaks (\n or \r\n). The finite-state machine enters the IN_QUOTED state upon encountering an opening quote and does not treat newline characters as row terminators until the closing quote is found. This means a single CSV row can span multiple text lines if the field is properly quoted.
All field values are treated as strings regardless of content. Numbers like 42 will be output as "42" (quoted), booleans as "true" (quoted), and null-like values as "null" (quoted). This is safer when your data contains identifiers that look like numbers (e.g., ZIP codes like 01234 or product SKUs).
Java is statically typed and does not support heterogeneous arrays natively. When type inference is enabled and mixed types are detected, the converter falls back to Object[] with explicit casting. For homogeneous numeric rows, it uses int[] or double[]. JSON output always preserves inferred types since the format supports mixed arrays natively.
Inside a quoted field, a literal double-quote character is represented by two consecutive double quotes (""). The parser's QUOTE_IN_QUOTED state (Sā‚ƒ) detects this: if the character following a quote inside a quoted field is another quote, it appends a single quote to the field value and returns to IN_QUOTED state. If the following character is a delimiter or newline, the field is closed.
Yes. Enable the "First row is header" option to skip the first row during array conversion. The header row values can optionally be used as keys when outputting associative arrays (PHP) or dictionaries (Python). For languages without native associative arrays, headers are included as a comment above the output.
The parser runs in O(n) time and processes input synchronously in the browser's main thread. For typical use cases under 50,000 rows (roughly 5 MB of CSV data), processing completes in under 200ms. Files exceeding 10 MB may cause brief UI freezing. The tool displays a progress indicator for inputs larger than 10,000 characters.