Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
latest
dbushell/jsonlikeJust enough JavaScript object validation.
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers




JSR Score
100%
Published
9 months ago (0.3.0)
🍋🟩 jsonlike
Just enough JavaScript object validation.
jsonlike is a tiny < 1kB library used to validate JavaScript objects against a JSON-like schema.
It can:
- Match properties by primitive types
- Match arrays of single type values
- Match nested objects
Usage
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'}] });
Notes
Use Ajv or Zod for full schema validation.
MIT License | Copyright © 2024 David Bushell
Built and signed on
GitHub Actions
Add Package
deno add jsr:@dbushell/jsonlike
Import symbol
import * as jsonlike from "@dbushell/jsonlike";
Import directly with a jsr specifier
import * as jsonlike from "jsr:@dbushell/jsonlike";
Add Package
pnpm i jsr:@dbushell/jsonlike
pnpm dlx jsr add @dbushell/jsonlike
Import symbol
import * as jsonlike from "@dbushell/jsonlike";
Add Package
yarn add jsr:@dbushell/jsonlike
yarn dlx jsr add @dbushell/jsonlike
Import symbol
import * as jsonlike from "@dbushell/jsonlike";
Add Package
vlt install jsr:@dbushell/jsonlike
Import symbol
import * as jsonlike from "@dbushell/jsonlike";
Add Package
npx jsr add @dbushell/jsonlike
Import symbol
import * as jsonlike from "@dbushell/jsonlike";
Add Package
bunx jsr add @dbushell/jsonlike
Import symbol
import * as jsonlike from "@dbushell/jsonlike";