Registry / documentation / json-schema-to-markdown

json-schema-to-markdown

JSON →
library1.1.1jsnpmunverified

Converts a JSON Schema object into a human-readable Markdown document. Stable version 1.1.1, low release cadence. Lightweight, synchronous, and easy to use. Does not implement full RFC; focuses on basic schema properties like title, description, type, and properties. Alternative to tools like json-schema-to-markdown-cli or custom templates.

npm install json-schema-to-markdown
INSTALL
IMPORT
SIG · JSON-SCHEMA-TO-MAR
J
json-schema-to-markdown
documentationjavascriptv1.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse
import parse from 'json-schema-to-markdown'
import { parse } from 'json-schema-to-markdown'
Module exports a single function as default. Named import will not work.
parse (CommonJS)
const parse = require('json-schema-to-markdown')
CommonJS require works fine; module is not ESM-only.
parse (TypeScript)
import parse from 'json-schema-to-markdown'
No TypeScript types are bundled; you may need to supply your own or use @types/json-schema-to-markdown if available.

Shows how to convert a JSON Schema to a Markdown string using CommonJS require.

const parse = require('json-schema-to-markdown'); const schema = { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Example Schema", "description": "This schema is awesome.", "type": "object", "properties": { "price": { "description": "Cost of the product.", "type": "number" } } }; const markdown = parse(schema); console.log(markdown);
Debug
Known issues
breakingOutput format may change in minor versions; no strict semver guarantee on generated markdown layout.
fix
Pin to exact version if you rely on markdown structure for parsing or diffing.
affects: >=1.0.0
deprecatedThe 'parse' function name is not descriptive; consider renaming in your code.
fix
Use a more descriptive alias: const toMarkdown = require('json-schema-to-markdown');
affects: >=1.0.0
gotchaDoes not support JSON Schema draft-07 or later features like if/then/else, const, etc.
fix
For newer drafts, consider using a different library or pre-processing the schema.
affects: >=1.0.0
gotchaThe input schema must be a JavaScript object, not a JSON string.
fix
Parse JSON strings with JSON.parse() before calling parse().
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: parse is not a function
Using named import instead of default import.
fix
Change to import parse from 'json-schema-to-markdown' or const parse = require('json-schema-to-markdown');
Cannot read property 'title' of undefined
Passing undefined or null as schema.
fix
Ensure you pass a valid JSON Schema object.
Unexpected token u in JSON at position 0
Passing a JSON string directly instead of a parsed object.
fix
Use JSON.parse(schemaString) before calling parse().
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
39 hits · last 30 days
node
32
Resources
json-schema-to-markdown — npm install json-schema-to-markdown · libregistry