Skip to content

Releases: iuccio/csvToJson

v4.37.0

19 Apr 15:28

Choose a tag to compare

Release Notes - v4.37.

🚀 New Features

Enhanced Streaming Parsing for Large Files

Memory-Efficient File Processing

  • Added getJsonFromFileStreamingAsync(file) method for processing large CSV files without loading them entirely into memory
  • Automatic fallback to regular parsing for older browsers that don't support native streaming
  • Optimized for files larger than 1MB to prevent memory issues

Progress Callbacks for Real-Time Feedback

  • New getJsonFromFileStreamingAsyncWithCallback(file, options) method with progress tracking
  • onChunk callback provides real-time updates during processing: (rows, processed, total) => {}
  • onComplete callback fires when processing finishes: (allRows) => {}
  • onError callback for error handling: (error) => {}
  • Configurable chunkSize option (default: 1000 rows per chunk)

Improved Browser Demo Experience

Visual Progress Indicators

  • Real-time progress bar for large file processing
  • Animated loading spinner with "Processing large file" message
  • Progress updates during chunked processing operations
  • Automatic progress bar removal after completion

Enhanced User Interface

  • Refactored demo code with modular architecture (UIManager, ConfigManager, FileProcessor, etc.)
  • Better error handling and user feedback
  • Improved responsive design and accessibility
  • Automatic streaming options for files > 1MB

📋 API Changes

New Methods

// Basic streaming (memory-efficient)
const data = await csvToJson.browser.getJsonFromFileStreamingAsync(file);

// Streaming with progress callbacks
await csvToJson.browser.getJsonFromFileStreamingAsyncWithCallback(file, {
  chunkSize: 1000,
  onChunk: (rows, processed, total) => {
    console.log(`Processed ${processed}/${total} rows`);
    // Update progress bar here
  },
  onComplete: (allRows) => {
    console.log('Processing complete!');
  },
  onError: (error) => {
    console.error('Error:', error);
  }
});

🔧 Technical Improvements

  • StreamProcessor class enhancements for better browser compatibility
  • Error handling improvements with specific error types
  • Memory management optimizations for large file processing
  • Browser API validation and input sanitization

🐛 Bug Fixes

  • Fixed progress bar display issues in demo
  • Improved error messages for invalid file inputs
  • Better handling of edge cases in streaming operations

📚 Documentation Updates

  • Updated README.md with streaming API examples
  • Added comprehensive JSDoc comments for new methods
  • Enhanced browser usage documentation
  • Updated demo with progress tracking examples

🔄 Migration Guide

For existing users:

  • No breaking changes to existing APIs
  • New streaming methods are additive features
  • Demo automatically uses streaming for large files

For upgrading:

npm update convert-csv-to-json

🎯 Performance Benefits

  • Memory Usage: Up to 90% reduction for large files (>1MB)
  • Processing Speed: Faster parsing with chunked processing
  • User Experience: Real-time feedback prevents UI freezing
  • Scalability: Handle files of any size without memory constraints

Release Notes - RFC 4180 Compliance Update

19 Mar 15:15

Choose a tag to compare

Release Notes - RFC 4180 Compliance Update

Version 4.0. - RFC 4180 Compliance

Overview

This release makes csvToJson fully compliant with RFC 4180, the standard format specification for CSV files. This is a significant update that improves standards compliance, reliability, and compatibility with CSV data from various sources.

RFC 4180 (Common Format and MIME Type for Comma-Separated Values (CSV) Files) is the official standard specification for CSV file formatting, maintained by the Internet Engineering Task Force (IETF).


🚀 Key Features

1. RFC 4180 Compliant CSV Parsing

  • Full support for RFC 4180 standard CSV format
  • Proper handling of quoted fields with embedded delimiters
  • Support for multi-line fields (fields containing newlines)
  • Correct quote escaping using double quotes ("")

2. Default Comma Delimiter (Breaking Change)

  • NEW: Comma (,) is now the default field delimiter (RFC 4180 standard)
  • BREAKING: Previous default was semicolon (;)
  • Allows parsing standard CSV files without explicit configuration
  • Maintains backward compatibility through explicit fieldDelimiter() calls

3. Improved Quoted Field Handling

  • Properly handles fields wrapped in quotes
  • Correctly processes escaped quotes within quoted fields
  • Supports empty quoted fields ("")
  • Handles fields containing delimiters, newlines, and special characters

4. Line Ending Support

  • Support for CRLF (\r\n) - Windows standard
  • Support for LF (\n) - Unix/Linux standard
  • Support for CR (\r) - older Mac standard
  • Automatic detection and handling

5. Code Quality Improvements

  • Refactored for better readability and maintainability
  • Added comprehensive JSDoc comments
  • Extracted complex logic into focused helper methods
  • Removed deprecated substr() method (replaced with slice())
  • Added braces to all conditional statements
  • Removed deprecated jsonToCsv() function

6. Comprehensive Test Coverage

  • 12 new RFC 4180 compliance tests
  • 12 new comma-delimiter tests
  • 109 total tests (up from 94)
  • Edge case handling verification

⚠️ Breaking Changes

1. Default Delimiter Changed to Comma

BEFORE:

const csvToJson = require('convert-csv-to-json');
// Default delimiter was semicolon (;)
let result = csvToJson.getJsonFromCsv('data.csv');

AFTER (RFC 4180 standard):

const csvToJson = require('convert-csv-to-json');
// Default delimiter is now comma (,)
let result = csvToJson.getJsonFromCsv('data.csv');
// File should be comma-delimited

Migration: If your CSV files use semicolons or other delimiters, explicitly set the delimiter:

csvToJson.fieldDelimiter(';').getJsonFromCsv('data.csv');

2. Removed Deprecated Function

The jsonToCsv() function has been removed. This was a deprecated alias.

BEFORE:

csvToJson.jsonToCsv('input.csv', 'output.json');

AFTER:

csvToJson.generateJsonFileFromCsv('input.csv', 'output.json');

3. Stricter Quoted Field Parsing

RFC 4180 compliant quote handling may parse some edge cases differently:

Example - Proper Quote Escaping:

// Input CSV: "name","description"
//            "John","He said ""Hello""" 
// Note: Double quotes "" represent a single quote

// Before: Might include literal quote characters
// After (RFC 4180): Correctly unescapes to: He said "Hello"

📋 Migration Guide

Quick Start for Existing Users

No changes needed if you:

  • Already explicitly set field delimiters with .fieldDelimiter()
  • Use quoted field support with .supportQuotedField(true)

Action required if you:

  • Rely on semicolon (;) as default delimiter
  • Use the removed jsonToCsv() function
  • Parse CSV files with quoted fields containing special characters

Step-by-Step Migration

Step 1: Update Delimiter Usage

If your files use a special delimiter, add explicit configuration:

// For semicolon-delimited files
csvToJson.fieldDelimiter(';').getJsonFromCsv('data.csv');

// For tab-delimited files
csvToJson.fieldDelimiter('\t').getJsonFromCsv('data.csv');

// For pipe-delimited files
csvToJson.fieldDelimiter('|').getJsonFromCsv('data.csv');

Step 2: Replace Deprecated Functions

Replace any usage of jsonToCsv():

// Old code
csvToJson.jsonToCsv('input.csv', 'output.json');

// New code
csvToJson.generateJsonFileFromCsv('input.csv', 'output.json');

Step 3: Test with RFC 4180 CSV Files

Test parsing standard CSV files without explicit delimiter:

// This now works with standard CSV files (comma-delimited)
let result = csvToJson.getJsonFromCsv('standard.csv');

📊 Feature Comparison

Feature Before After
Default Delimiter ; (semicolon) , (comma) - RFC 4180
Quoted Fields Partial support Full RFC 4180 support
Multi-line Fields Not supported Fully supported
Empty Quoted Fields Issues Correctly handled
Quote Escaping Partial RFC 4180 compliant ("")
Line Endings Limited CRLF, LF, CR all supported
Code Quality Basic Refactored & maintainable

🧪 Testing

All changes have been validated with comprehensive test coverage:

  • 109+ tests across 13 test suites
  • RFC 4180 compliance tests - 15 tests
  • Comma delimiter tests - 12 tests
  • Backward compatibility tests - All existing tests pass

Run tests:

npm test              # All tests with coverage
npm test -- --no-coverage    # Quick test run
npm test test/rfc4180.spec.js            # RFC 4180 tests only
npm test test/comma-delimiter.spec.js    # Comma delimiter tests

📚 Documentation

New Resources

  • Comprehensive RFC 4180 Migration Guide - See RFC4180_MIGRATION_GUIDE.md
  • RFC 4180 Compliance Tests - See test/rfc4180.spec.js
  • Comma Delimiter Tests - See test/comma-delimiter.spec.js

RFC 4180 Standard

  • Official RFC 4180 specification: https://tools.ietf.org/html/rfc4180
  • Key points:
    • Comma is the field delimiter
    • Quoted fields with embedded delimiters/newlines
    • Double quotes escape quotes within fields
    • CRLF line endings recommended

🔄 Backward Compatibility

Partially Compatible - Most applications will work without changes if they:

  • Already use .fieldDelimiter() explicitly
  • Use .supportQuotedField(true) for quoted fields
  • Don't rely on the removed jsonToCsv() function

Requires Updates if you:

  • Rely on semicolon as default delimiter
  • Parse semicolon-delimited CSV files without explicit configuration

💡 Examples

Example 1: Parse Standard CSV File (Default Comma)

const csvToJson = require('convert-csv-to-json');

// CSV file: name,age,city
//            John,30,NYC
//            Jane,25,LA

let result = csvToJson.getJsonFromCsv('data.csv');
// [{ name: 'John', age: '30', city: 'NYC' },
//  { name: 'Jane', age: '25', city: 'LA' }]

Example 2: Parse CSV String with Quoted Fields

let csv = 'name,email,status\n' +
          '"Smith, John","john@example.com","Active"\n' +
          '"Doe, Jane","jane@example.com","Inactive"\n';

let result = csvToJson.supportQuotedField(true).csvStringToJson(csv);
// [{ name: 'Smith, John', email: 'john@example.com', status: 'Active' },
//  { name: 'Doe, Jane', email: 'jane@example.com', status: 'Inactive' }]

Example 3: Parse Multi-line Fields

let csv = 'id,description\n' +
          '1,"This is a\nmulti-line\ndescription"\n' +
          '2,"Single line"\n';

let result = csvToJson.supportQuotedField(true).csvStringToJson(csv);
// [{ id: '1', description: 'This is a\nmulti-line\ndescription' },
//  { id: '2', description: 'Single line' }]

Example 4: Migrate from Semicolon-Delimited

// For backward compatibility with semicolon-delimited files
let result = csvToJson.fieldDelimiter(';').getJsonFromCsv('data.csv');

🐛 Bug Fixes

  • Fixed handling of empty quoted fields ("")
  • Fixed multi-line field parsing within quoted regions
  • Fixed quote escaping detection (RFC 4180 compliant)
  • Fixed line ending detection (CRLF, LF, CR)
  • Removed deprecated substr() usage

✨ Internal Improvements

  • Refactored parseRecords() method - Clearer line-ending detection with getLineEndingLength() helper
  • Refactored split() method - Extracted quote handling into isEscapedQuote() and isEmptyQuotedField() helpers
  • Named constants - QUOTE_CHAR, CRLF, LF, CR for clarity
  • JSDoc comments - Comprehensive documentation for all complex methods
  • Code consistency - All if statements now have braces

📦 Installation

npm install convert-csv-to-json@latest

Or update existing installation:

npm update convert-csv-to-json

🤝 Support

For issues, questions, or migration assistance:


📝 Changelog

v4.0.0 (2026-03-19)

  • ✨ RFC 4180 compliance achieved
  • 🔄 Default delimiter changed to comma
  • 🧹 Code refactored for maintainability
  • ✅ 109+ comprehensive tests
  • 📚 Full documentation updates
  • ⚠️ Removed deprecated jsonToCsv() function

Thank you for using csvToJson! We believe this RFC 4180 update makes the library more standards-compliant and reliable for real-world CSV parsing needs.

Fix indexHeader is not a funtion, #39

30 Nov 16:56

Choose a tag to compare

🎉 Fix indexHeader is not a function

📝 Summary

What's Changed

Full Changelog: v3.18.0...v3.19.0

Sync NodeJS Support

23 Nov 09:46

Choose a tag to compare

🎉 Sync NodeJS Support

📝 Summary

  • Remove NodeJS Support for version 14.x and 16.x
  • Add Support for NodeJS 25.x

What's Changed

Full Changelog: v3.15.0...v3.16.0

Support for Browser API

22 Nov 20:39

Choose a tag to compare

🎉 New Release: Browser API

📝 Summary

This release adds first-class Browser support and a dedicated Browser API so convert-csv-to-json can be used directly in frontend apps and bundlers. The Browser API provides browser-friendly helpers for parsing CSV strings and File/Blob objects and includes TypeScript typings.

See the Browser API Usage documentation


✨ Highlights

  • Browser support (usable in modern browsers via bundlers or ESM imports).
  • New browser helper exposing sync and async methods:
    • browser.csvStringToJson(...)
    • browser.csvStringToJsonAsync(...)
    • browser.csvStringToJsonStringified(...)
    • browser.parseFile(file, options) (returns Promise)
  • TypeScript typings available in index.d.ts.
  • No breaking changes to existing Node APIs.

📦 What's new

  • browser API mirrors the library configuration methods (e.g. .fieldDelimiter(), .formatValueByType(), .supportQuotedField()).
  • parseFile reads File/Blob using the browser FileReader API and resolves with a parsed array of objects.
  • Added browser-focused tests and TypeScript test coverage.

What's Changed

Full Changelog: v3.14.0...v3.15.0

Async Support

01 Nov 08:52

Choose a tag to compare

🎉 New Release: Async Support

✨ Highlights

  • Promise-based async API for modern JavaScript applications
  • Improved memory handling for large files
  • Full backward compatibility maintained
  • Comprehensive documentation and migration guide

📦 Added

  • getJsonFromCsvAsync() - Promise-based CSV parsing
  • generateJsonFileFromCsvAsync() - Async file generation
  • Migration guide with best practices
  • TypeScript definitions for async API
  • Performance optimization examples

🔧 Enhanced

  • Documentation structure and examples
  • Large file processing capabilities
  • Error handling and recovery patterns
  • TypeScript support

📝 Notes

  • Zero breaking changes
  • Existing sync API remains unchanged
  • Gradual migration path available

Change license to MIT

02 May 14:05

Choose a tag to compare

Starting with version v3.0.0, csvToJson is released under the MIT license, which is more permissive than GPL-3.0.

CI/CD from github action

25 Feb 18:33

Choose a tag to compare

From now pushing on master branch will always bump a new release see CI/CD

Migration to jest

17 Feb 19:59

Choose a tag to compare

  • Migration to jest
  • NodeJs v12.x no longer supported

Add Support Quoted Fields

24 Feb 20:17

Choose a tag to compare

No Breaking Changes.
Add Support Quoted Fields: see documentation Support Quoted Fields.

Closes #23