Generate an object based on default values defined in a JSON Schema. This package extracts only the default values from a schema, ignoring 'required' constraints, making it suitable for pre-filling forms or merging with existing data to ensure defaults are present. v1.0.2 targets Node 18+ and ships TypeScript types. It differs from json-schema-empty (which respects 'required' and creates placeholder values) by focusing strictly on explicit defaults. Release cadence: low (single stable release as of 2024). Key alternatives: AJV's assignDefaults, json-schema-empty, json-schema-fill-defaults.
npm install json-schema-defaultNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Generates a plain object from JSON Schema defaults; properties without default are omitted.
Use json-schema-empty or json-schema-empty-strings if you need placeholders.
Simplify schema or pre-resolve with a tool like AJV before calling jsonDefault.
Use dynamic import() or upgrade Node to 18+.
Validate schema with AJV before passing to jsonDefault.
Add "type": "module" in package.json or use dynamic import().
Use import { jsonDefault } from 'json-schema-default'.Use import statement instead of require().
No dependency data recorded yet.