Fast JSON <-> CSV conversion with streaming helpers, NDJSON/TSV support, and optional integrations.
- JSON <-> CSV conversion with security defaults
- Streaming helpers and async iterator API
- NDJSON and TSV helpers
- Browser bundle with Web Worker helpers
- Optional plugin system and framework adapters
- CLI and optional TUI
npm install jtcsvnpm install @jtcsv/tui
npm install @jtcsv/excel exceljs
npm install @jtcsv/validatorconst { jsonToCsv, csvToJson } = require('jtcsv');
const data = [
{ id: 1, name: 'John', email: 'john@example.com' },
{ id: 2, name: 'Jane', email: 'jane@example.com' }
];
const csv = jsonToCsv(data, { delimiter: ',', includeHeaders: true });
const json = csvToJson(csv, { delimiter: ',', parseNumbers: true });
console.log(csv);
console.log(json);const { csvToJsonIterator } = require('jtcsv');
const csv = 'id,name\n1,Jane\n2,John';
for await (const row of csvToJsonIterator(csv, { fastPathMode: 'compact' })) {
console.log(row);
}- Bundler:
import { csvToJson, jsonToCsv } from 'jtcsv/browser'; - CDN UMD:
https://cdn.jsdelivr.net/npm/jtcsv/dist/jtcsv.umd.js - CDN ESM:
https://cdn.jsdelivr.net/npm/jtcsv/dist/jtcsv.esm.js
See README-browser.md for full browser API and worker helpers.
npx jtcsv csv-to-json input.csv output.json
npx jtcsv json-to-csv input.json output.csv
npx jtcsv stream csv-to-json big.csv output.json
npx jtcsv batch json-to-csv "data/*.json" output/
# optional TUI
npx jtcsv tuiSee CLI.md for full command list and options.
Run these from the repo root:
# Express API demo
npm run demo
# Web demo (Vite dev server on http://localhost:3000)
npm run demo:web
# Preview built demo
npm run demo:serveFrom inside demo/ use:
npm run dev
npm run preview
npm run serveThe plugin-enabled API is exported from jtcsv/plugins.
const { create } = require('jtcsv/plugins');
const jtcsv = create();
jtcsv.use('my-plugin', { name: 'My Plugin', version: '1.0.0' });See README-PLUGINS.md and plugins/README.md for integrations.
Run from the repo root:
npm test
npm run test:coverage
npm run buildMIT. See LICENSE.