webdev_csv_to_json
Convert delimited (CSV) text into JSON with type coercion, customizable delimiter/enclosure, optional header row, and output as objects or arrays.
Instructions
CSV to JSON Converter. Parse delimited (CSV) text into JSON, with type coercion (numeric/boolean/null), custom delimiter/enclosure/escape, optional header row, and array-of-objects or array-of-arrays output. This is the CSV-to-JSON direction: use webdev_json_to_csv for the reverse, json_formatter to pretty-print/validate existing JSON, or text_column_tool to align/extract columns without converting. Runs locally via a Node bridge: read-only, non-destructive, contacts no external service, rate-limited (60 req/min anon). Returns the JSON string plus validity flag, per-row column-mismatch warnings, and size/row/column statistics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| csv | Yes | CSV text to convert. Must be non-empty. | |
| delimiter | No | Field separator. Empty string falls back to comma. | , |
| enclosure | No | Quote character wrapping fields that contain delimiters or newlines. | " |
| escape | No | Character that escapes an enclosure character inside a quoted field. | " |
| hasHeader | No | Treat the first row as column names; when false, object keys become Column1, Column2, etc. | |
| outputFormat | No | object = array of keyed records; array = array of value arrays. Alias: format. Unknown values fall back to object. | object |
| prettyPrint | No | Indent the JSON string with 2 spaces; false produces compact JSON. | |
| skipEmptyRows | No | Drop rows that are blank or all-empty after parsing. | |
| trimFields | No | Strip leading/trailing whitespace from every field and header. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| original | No | The original CSV input, echoed back. | |
| json | No | The converted JSON as a string (indented when prettyPrint is true). | |
| isValid | No | True when no fatal parse errors occurred. | |
| errors | No | Fatal parse error messages (non-field-mismatch); empty on success. | |
| warnings | No | Per-row column-count mismatch messages. | |
| stats | No | Conversion metrics. |