json-to-anything
v1.0.2
Published
JSON → Anything Converter - end product bundle (ES module)
Maintainers
Readme
json-anything-endproduct
JSON → Anything Converter — compact ES module with 25 dependency-free converters for quick conversions, docs and prototypes.
Why this package stands out:
- Small and dependency-free — ideal for embedding in docs or developer tools.
- Multi-format: CSV, YAML-like, SQL, TypeScript, language class generators and more.
- ESM-first: ship as a modern ES module (
type: module).
Quick install (local development):
# from project root
cd npm
npm installInstall from npm (when published):
npm i json-to-anythingQuick usage (ES modules)
import { toCSV, toYAML, toMarkdownTable } from 'json-to-anything';
const data = [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }];
console.log(toCSV(data));
console.log(toYAML(data));
console.log(toMarkdownTable(data));Test from the repo (no publish):
node -e "import('./npm/index.js').then(m=>console.log(m.toCSV([{a:1,b:2}])))"Core API (selected converters)
- toYAML — YAML-like serializer
- toCSV — CSV generator (headers from keys)
- toTypeScript — TypeScript interface generator
- toJS — pretty-printed JSON
- toSchemaSummary — key:type summary
- toHTMLTable / toHTML — HTML table
- toQuery / toFormURLEncoded — URL encoders
- toMarkdownTable — Markdown table
- toPlantUML / toMermaid — diagram skeletons
- toSQLInsert / toSQLiteInsert / toMySQLInsert / toPostgresInsert — SQL INSERTs
- toBashExport — bash env exports
- toCSharp / toJava / toPythonDataclass / toGoStruct / toRustStruct / toDartClass / toPHPArray — language-specific outputs
- toProto — naive proto3 generator
License
MIT
