Package Exports
- json-to-anything
- json-to-anything/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (json-to-anything) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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