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

json2jsclass

v1.0.0

Published

Convert JSON files to JavaScript class files

Readme

json2jsclass

🚀 将 JSON 文件转换为 JavaScript 类定义的命令行工具。

功能特性

快速转换:将 JSON 结构自动生成可复用的 JavaScript 类 • 支持嵌套:自动处理嵌套对象和数组 • ESM 原生:基于 ES Modules 开发,适配现代 Node.js 环境 • CLI 友好:提供简洁的命令行交互

安装

全局安装(推荐)

npm install -g json2jsclass

使用方法

基础命令

json2jsclass <input.json> [options]

示例

# 转换 JSON 文件,默认生成到 ./output.js
json2jsclass sample.json

# 指定输出路径
json2jsclass sample.json --output ./src/models.js

选项

| 选项 | 描述 | 默认值 | |---------------------|--------------------------|---------------| | -o, --output <path> | 指定输出文件路径 | ./output.js | | -v, --version | 显示版本号 | - | | -h, --help | 显示帮助信息 | - |

开发指南

克隆仓库

https://gitee.com/cjlmonster/json2jsclass.git
cd json2jsclass

本地测试(使用 npm link)

npm link
# 然后即可全局使用 json2jsclass 命令

项目结构

.
├── bin/
│   └── cli.js        # 命令行入口
├── lib/
│   └── converter.js  # 核心转换逻辑
├── package.json
└── README.md

技术约束

• Node.js 14+ 环境 • 仅支持 UTF-8 编码的 JSON 文件 • 输出文件扩展名需为 .js

贡献代码

欢迎提交 Issue 或 PR:

  1. Fork 本项目
  2. 创建特性分支 (git checkout -b feature/awesome)
  3. 提交修改 (git commit -am 'Add awesome feature')
  4. 推送分支 (git push origin feature/awesome)
  5. 新建 Pull Request

许可协议

MIT License