Registry / testing / jsen
library0.6.6jsnpmunverified

jsen (JSON Sentinel) is a JSON Schema validator built for speed using dynamic code generation for V8 optimization. It supports JSON-Schema draft 4, remote and external schemas, custom formats and error messages, default value gathering, and greedy validation. The current stable version is 0.6.6 with low release cadence (last update 2019). It differentiates itself with performance benchmarks showing it faster than alternatives like z-schema, jsck, themis, and others. However, it lacks modern JSON Schema drafts (draft-06/07/2019-09), TypeScript types, and is not actively maintained.

npm install jsen
INSTALL
IMPORT
SIG · JSEN
J
jsen
testingjavascriptv0.6.6
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.

jsen
import jsen from 'jsen'
const jsen = require('jsen');
Package is CommonJS but can be used with ES modules; default import works in both.
validate
const validate = jsen({ type: 'string' });
const validate = new jsen({ type: 'string' });
jsen is a function, not a constructor.
jsen (with options)
const validate = jsen(schema, { greedy: true });
const validate = jsen(schema, { mode: 'greedy' });
Options like 'greedy' are boolean, not a mode string.

Validates an object against a JSON Schema using jsen, showing success and failure with error details.

import jsen from 'jsen'; const schema = { type: 'object', properties: { name: { type: 'string' }, age: { type: 'number', minimum: 0 } }, required: ['name', 'age'] }; const validate = jsen(schema); const valid = validate({ name: 'Alice', age: 30 }); console.log(valid); // true const invalid = validate({ name: 'Bob' }); console.log(invalid); // false console.log(validate.errors); // [{ path: '', keyword: 'required', message: 'requires property "age"' }]
Debug
Known issues
deprecatedPackage is no longer actively maintained; last release in 2019
fix
Consider switching to actively maintained validators like Ajv or jsonschema.
affects: >=0.6.6
gotchajsen only supports JSON Schema draft 4, not newer drafts (draft-06, draft-07, 2019-09, 2020-12)
fix
Ensure your schema conforms to draft 4, or use a validator that supports newer drafts.
affects: >=0.0.0
gotchaMalformed schema keywords are silently ignored instead of throwing an error; validation always succeeds for incorrectly defined keywords
fix
Use a JSON Schema metaschema or a separate validation step to ensure your schema is correct.
affects: >=0.0.0
gotchaDynamic code generation (eval) used for performance; may be blocked in some environments (e.g., CSP-restricted browsers)
fix
If used in browser with strict CSP, evaluate if eval is allowed or choose another validator.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: jsen is not a function
Using 'new jsen()' thinking it's a constructor.
fix
Replace 'new jsen(schema)' with 'jsen(schema)'.
Error: schema is not a valid schema object
Passing a non-object (e.g., string) to jsen.
fix
Ensure the schema argument is a valid JSON Schema object, e.g., { type: 'string' }.
Validation always returns true
Schema has incorrectly defined keywords (e.g., 'properties' as array instead of object).
fix
Validate your schema against JSON Schema metaschema or check keyword definitions.
Upgrade
Version history
0.6.6latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
packagejsen