Just enough JavaScript object validation.
jsonlike is a tiny < 1kB library used to validate JavaScript objects against a JSON-like schema.
It can:
import {jsonlike} from '@dbushell/jsonlike';
const json = JSON.parse(`{
"greeting": "Hello, World!",
"items": [{"id": 1}, {"id": 2}, {"id": 3}]
}`);
const valid = jsonlike(json, {
greeting: 'string',
items: [{id: 'number'}]
});
Use Ajv for full schema validation.
MIT License | Copyright © 2024 David Bushell