Generates a plain JSON object from the default values defined in a JSON Schema. Version 0.4.0 is the latest stable release (final release from 2015, now unmaintained). Supports both Node.js and browser environments, including CommonJS, AMD, and standalone script tag usage. Also provides a CLI tool. This package is a simple utility for extracting default values from schemas and does not support JSON Schema draft-07+ features like const, if/then/else, or complex defaults. It works with basic default values only (no recursive objects). The package has no dependencies and is very small (~1KB minified).
npm install json-schema-defaultsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic usage showing extraction of default values from a JSON Schema object.
Consider using @json-schema-tools/defaults or ajv defaults for modern schema support.
Manually handle nested schemas or use a recursive solution.
Use a more comprehensive schema processing library.
Redirect stdout as needed, e.g., json-schema-defaults schema.json > output.json
Run npm install json-schema-defaults and ensure correct require path.
Use the standalone script tag instead: <script src='lib/defaults.js'></script>
Use const defaults = require('json-schema-defaults'); in Node or use the global window.jsonSchemaDefaults in browser.No dependency data recorded yet.