npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@alexanderweigelt/json2csv

v1.0.3

Published

Converter between JSON and CSV

Readme

json2csv

A small tool to convert JSON and CSV.

  • It is simple.
  • It has no extra dependencies.
  • It uses semicolon (;) as delimiter.
  • It works only with flat data (no nested objects or arrays).

Install

  • Clone or copy the project.
  • Install dev dependencies (for tests only):
npm install @alexanderweigelt/json2csv

Run

  • Convert JSON to CSV:
node convert.js input.json output.csv
  • Convert CSV to JSON:
node convert.js input.csv output.json

Usage as Binary (CLI)

  • Without prior installation (if the package is available in the standard registry):
npx json2csv input.json output.csv
  • Obtain explicitly via the package and execute the binary:
npx -p @alexanderweigelt/json2csv json2csv input.json output.csv
  • Locale installed (as dependency to the project):
npx json2csv input.csv output.json
  • Global installed:
npm i -g @alexanderweigelt/json2csv
json2csv input.json output.csv

What it can do

  1. JSON object -> CSV (key;value lines)
  • Input: one flat JSON object
  • Output: CSV with two columns: "key";"value"
  • Each line is one key and its value
  • All fields are quoted
  • Quotes inside values are escaped as ""

Example:

{
"a": "1",
"b": "2"
}
"a";"1"
"b";"2"
  1. CSV key;value lines -> JSON object
  • Input: CSV with exactly two columns in every row
  • No header row
  • Output: one JSON object, keys from column 1, values from column 2
  • Quotes are handled. "" becomes " in values.

Example:

"a";"1"
"b";"2"
{ "a": "1", "b": "2" }

Rules and limits

  • Delimiter is always semicolon (;)
  • All fields are always quoted
  • Only flat data is supported
  • No nested objects, no arrays inside objects
  • Whitespace at start/end of file is trimmed
  • Output ends with a newline

Testing

  • Run tests:
npm test

License

ISC