Urgent.News

What's breaking now, across thousands of outlets.

Tech

I benchmarked CSV vs JSON on 200k rows so you don't have to

Most "CSV vs JSON" comparisons are vibes. Here are real numbers, measured on a real dataset. Setup: 200,000 rows x 12 columns, Node v22.18.0, no streaming tricks. Metric Result CSV file size 20.5 MB JSON file size 49.3 MB Size ratio CSV is 2.4x smaller CSV to JSON speed ~75,234 rows/sec JSON to CSV speed ~70,908 rows/sec Round-trip Lossless Why JSON is bigger: repeated key names on every object,…

The article provides a detailed benchmark comparison between CSV and JSON formats utilizing a dataset containing 200,000 rows with 12 columns each. The setup used Node.js version 22.18.0, without employing any streaming optimization techniques.

Key metrics revealed that CSV files were 2.4 times smaller in size compared to their JSON counterparts. In terms of conversion speed, the process of transforming CSV to JSON was approximately 75,234 rows per second, while converting JSON back to CSV occurred at a rate of about 70,908 rows per second, indicating a relatively close performance gap.

The primary reason behind JSON's increased file size can be attributed to the repeated use of key names for every object, along with the necessity of escaping quotes and non-ASCII characters. This additional data, although necessary, contributes significantly to the overall size, directly impacting bandwidth and storage costs for applications like log files and export pipelines.

The article concludes by recommending the use of JSON for APIs and nested structures, while advocating CSV format for storage purposes, spreadsheets, and analytics imports. It notes that for flat table data, CSV tends to provide better size efficiency and compatibility with various tools.

To facilitate seamless data conversion between JSON, CSV, and TSV formats, the author developed a free, in-browser converter tool that operates entirely on the client-side, ensuring that user data remains secure and local. The converter along with a comprehensive guide detailing the methodology behind the benchmark can be accessed via the following links: https://instant-data-converter.vercel.app and https://instant-data-converter.vercel.app/guides/csv-vs-json respectively.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Automating DEV: seven things the Forem API does not tell you

I have published nine articles here without opening the editor once — written, tagged, illustrated, corrected and retitled entirely through the API, because the thing writing them is an agent and not…

  • Forem API lacks documentation on seven critical issues
  • published: true in front matter doesn't determine article status
  • Updating tags via API doesn't affect article tags

More from Thursday 6 August →