CSV To JSON Converter

Turn CSV data into JSON with options.

Configure inputs in pipeline.

Output will appear here.

For informational purposes only.

No data is stored or transmitted.

(function(){ const csvInput = document.querySelector('#csv'); const btn = document.getElementById('run-btn'); const display = document.querySelector('.result'); const parseCSV = (text)=>{ const lines = text.split(/\r?\n/).filter(l=>l.trim().length>0); if(lines.length < 2) return []; const headers = lines[0].split(',').map(h=>h.trim()); return lines.slice(1).map(line=>{ const cols = line.split(','); const obj = {}; headers.forEach((h,i)=> obj[h] = (cols[i]||'').trim()); return obj; }); }; btn?.addEventListener('click', ()=>{ try { const arr = parseCSV(csvInput?.value || ''); display.textContent = JSON.stringify(arr, null, 2); } catch(e){ if(display) display.textContent = 'Error: ' + e.message; } }); })();