Filters objects from a JSON document based on a JSON Schema, removing properties not defined in the schema. Version 0.1.5 is the latest. It recursively processes nested objects and arrays, but does not validate against the schema; for validation use a separate tool like JSV. Designed for performance when the schema is smaller than the document. Typically used for cleaning up JSON data by stripping unknown fields.
npm install json-schema-filterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows filtering a simple object using a schema, removing properties not in the schema.
Ensure your schema does not list properties you expect to always be present unless you handle missing keys separately.
Define all properties explicitly in the schema to preserve them.
After filtering, run your data through a JSON Schema validator if you need validation.
Ensure your schema uses 'items' for all array elements; additional items will be kept.
Use require('json-schema-filter') instead of import.Ensure the schema object has a 'type' field at every level where you want filtering.
Define at least one property in the schema to keep the object.
No dependency data recorded yet.