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

@supercat1337/mysql-to-json

v1.1.0

Published

A simple tool to convert MySQL tables to JSON

Readme

mysql-to-json

A modern GUI tool to explore MySQL databases – view table schemas and detailed index statistics in JSON format.

Overview

mysql-to-json connects to a MySQL database and provides a clean web interface to:

  • List all databases on the server
  • Browse table structures (columns, data types, keys, etc.)
  • Generate JSON output of table schemas
  • New: Fetch and display detailed index statistics (index name, columns, uniqueness, cardinality, etc.)

The tool now uses a modern vanilla CSS design (no Bootstrap) with a responsive card layout and two independent output panels – one for column schemas and one for index information.

Installation

Install globally via npm:

npm install -g @supercat1337/mysql-to-json

Usage

Start the tool with the following command:

mysql-to-json [--port PORT] [--db_port PORT] [--db_host HOST] [--user USER] [--password PASS] [--help]

Options

| Option | Description | Default | | ------------ | ------------------ | ----------- | | --port | Web interface port | 3000 | | --db_port | MySQL server port | 3306 | | --db_host | MySQL host | localhost | | --user | MySQL user | root | | --password | MySQL password | "" | | --help | Show help message | – |

Example

Connect to a remote MySQL instance and start the tool on port 4000:

mysql-to-json --db_host my-db.example.com --db_port 3307 --user admin --password secret --port 4000

Then open http://localhost:4000 in your browser.

Features

1. Database & Table Explorer

  • Click on a database to load its tables.
  • Select tables using checkboxes.
  • Buttons to Check all / Uncheck all tables.

2. Schema Output

For the selected tables, you can generate:

  • Raw JSON – full INFORMATION_SCHEMA.COLUMNS data.
  • JS Objects – JavaScript object literals with column metadata.
  • JS Class – ES6 class definitions (e.g., UsersItem) with typed properties.

3. Index Statistics (New)

  • Click “Fetch Index Stats for checked tables” to retrieve detailed index information from INFORMATION_SCHEMA.STATISTICS.
  • Output includes:
    • Index name
    • Column name within the index
    • Uniqueness (non‑unique flag)
    • Index type (BTREE, HASH, etc.)
    • Cardinality (estimate of unique values)
    • Sub‑part length, nullability, collation ordering.

Development

Build from source

git clone https://github.com/supercat1337/mysql-to-json.git
cd mysql-to-json
npm install
npm run build   # bundles frontend JS

Project structure (after cleanup)

├── app/                 # Backend (Express server, MySQL connection)
├── bin/                 # CLI entry point
├── dist/public/         # Static assets (HTML, bundled JS, CSS)
├── src/frontend/        # Frontend modules (API calls, UI helpers, schema converters)
├── .prettierrc          # Code formatter config
└── package.json

License

MIT