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

morph-data

v1.0.1

Published

High-fidelity data conversion between CSV, JSON, YAML, and Markdown table formats. Zero dependencies, lightweight, and battle-tested for production use.

Readme

morph-data

High-fidelity data conversion between CSV, JSON, YAML, and Markdown table formats. Zero dependencies, lightweight, and built for production use.

npm version license


Features

  • CSV to JSON -- Parses CSV strings into arrays of objects with automatic type detection (numbers, booleans).
  • JSON to CSV -- Converts arrays of objects to properly escaped CSV strings with configurable delimiters.
  • JSON to YAML -- Serializes JavaScript objects and arrays into clean YAML output.
  • JSON to Markdown Table -- Generates formatted Markdown tables from structured data.
  • Quoted Field Handling -- Correctly handles commas, newlines, and escaped quotes inside CSV fields.
  • Zero Dependencies -- No external packages required. Tiny footprint for your bundle.

Installation

npm install morph-data

Usage

CSV to JSON

const morph = require('morph-data');

const csv = `id,name,email,active
1,"Doe, John",[email protected],true
2,"Smith, Jane",[email protected],false
3,"Williams, Bob",[email protected],true`;

const result = morph.csvToJson(csv);
console.log(result);

// Output:
// [
//   { id: 1, name: 'Doe, John', email: '[email protected]', active: true },
//   { id: 2, name: 'Smith, Jane', email: '[email protected]', active: false },
//   { id: 3, name: 'Williams, Bob', email: '[email protected]', active: true }
// ]

JSON to CSV

const morph = require('morph-data');

const users = [
  { id: 1, name: 'Alice', department: 'Engineering', salary: 95000 },
  { id: 2, name: 'Bob', department: 'Design', salary: 85000 },
  { id: 3, name: 'Charlie', department: 'Marketing', salary: 78000 }
];

const csv = morph.jsonToCsv(users);
console.log(csv);

// Output:
// id,name,department,salary
// 1,Alice,Engineering,95000
// 2,Bob,Design,85000
// 3,Charlie,Marketing,78000

JSON to CSV with Custom Delimiter

const morph = require('morph-data');

const data = [
  { product: 'Laptop', price: 1299.99, stock: 45 },
  { product: 'Mouse', price: 29.99, stock: 200 }
];

// Use semicolons (common in European CSV formats)
const csv = morph.jsonToCsv(data, ';');
console.log(csv);

// Output:
// product;price;stock
// Laptop;1299.99;45
// Mouse;29.99;200

JSON to YAML

const morph = require('morph-data');

const config = {
  server: {
    port: 8080,
    host: 'localhost',
    ssl: false
  },
  database: {
    host: 'db.example.com',
    port: 5432,
    name: 'myapp'
  },
  features: ['authentication', 'caching', 'logging']
};

const yaml = morph.jsonToYaml(config);
console.log(yaml);

// Output:
// server:
//   port: 8080
//   host: localhost
//   ssl: false
// database:
//   host: db.example.com
//   port: 5432
//   name: myapp
// features:
//   - authentication
//   - caching
//   - logging

JSON to Markdown Table

const morph = require('morph-data');

const packages = [
  { name: 'morph-data', version: '1.0.0', downloads: 1200 },
  { name: 'mem-stash', version: '2.1.0', downloads: 890 },
  { name: 'seo-meta', version: '1.3.0', downloads: 2100 }
];

const table = morph.jsonToMarkdownTable(packages);
console.log(table);

// Output:
// | name | version | downloads |
// | --- | --- | --- |
// | morph-data | 1.0.0 | 1200 |
// | mem-stash | 2.1.0 | 890 |
// | seo-meta | 1.3.0 | 2100 |

Using a Custom Instance

const { MorphData } = require('morph-data');

const transformer = new MorphData();
const json = transformer.csvToJson(myCsvString);

API Reference

| Method | Parameters | Returns | Description | | --- | --- | --- | --- | | csvToJson(csv, delimiter) | csv: string, delimiter: string (default ',') | Array<Object> | Parses CSV into JSON objects | | jsonToCsv(json, delimiter) | json: Array<Object>, delimiter: string (default ',') | string | Converts JSON to CSV string | | jsonToYaml(json, indent) | json: Object, indent: number (default 2) | string | Serializes JSON to YAML | | jsonToMarkdownTable(json) | json: Array<Object> | string | Converts JSON to Markdown table |


License

MIT -- see LICENSE for details.