{"id":25300260,"url":"https://github.com/kledenai/jsonverify","last_synced_at":"2026-02-26T01:05:12.705Z","repository":{"id":270824323,"uuid":"911578320","full_name":"Kledenai/jsonverify","owner":"Kledenai","description":"A lightweight JSON schema and data validator.","archived":false,"fork":false,"pushed_at":"2025-01-10T19:02:32.000Z","size":111,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-11T06:05:18.431Z","etag":null,"topics":["json","schema","typescript","validator"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/jsonverify","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kledenai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-03T10:51:13.000Z","updated_at":"2025-01-10T21:41:30.000Z","dependencies_parsed_at":"2025-01-03T12:22:34.925Z","dependency_job_id":null,"html_url":"https://github.com/Kledenai/jsonverify","commit_stats":null,"previous_names":["kledenai/jsonverify","kledenai/jsoncheck"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kledenai%2Fjsonverify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kledenai%2Fjsonverify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kledenai%2Fjsonverify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kledenai%2Fjsonverify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kledenai","download_url":"https://codeload.github.com/Kledenai/jsonverify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238603684,"owners_count":19499492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","schema","typescript","validator"],"created_at":"2025-02-13T05:48:27.144Z","updated_at":"2025-10-28T06:30:58.479Z","avatar_url":"https://github.com/Kledenai.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://img.shields.io/npm/v/jsonverify)](https://www.npmjs.com/package/jsonverify)\n\n# Jsonverify\n\n**Jsonverify** is a lightweight library for validating JSON schemas and data, written in TypeScript. It ensures that the provided data complies with defined schemas, making it ideal for JSON-based applications like APIs, configuration systems, or validation layers in modern applications.\n\n## ✨ Why Use Jsonverify?\n\n- 🚀 **Lightweight and Fast**: Optimized for performance in real-world applications.\n- 🛠️ **TypeScript First**: Fully typed for better developer experience and type safety.\n- 🔍 **Flexible**: Supports primitive types, nested schemas, arrays, and advanced constraints.\n- ✅ **Easy to Use**: Intuitive API that gets you started quickly.\n\n## 📦 Installation\n\nYou can install jsonverify using npm or yarn:\n\n```bash\nnpm install jsonverify\n```\n\nor\n\n```bash\nyarn add jsonverify\n```\n\n## 🛠️ Usage\n\n### Importing\n\n```typescript\nimport { validate } from \"jsonverify\";\n```\n\n### Validating Basic Data\n\n```typescript\nconst schema = {\n  name: \"string\",\n  age: \"number\",\n};\n\nconst data = {\n  name: \"John\",\n  age: 30,\n};\n\nconsole.log(validate(schema, data)); // true\n```\n\n### Validating Nested Data\n\n```typescript\nconst schema = {\n  user: {\n    name: \"string\",\n    age: \"number\",\n  },\n};\n\nconst data = {\n  user: {\n    name: \"Alice\",\n    age: 25,\n  },\n};\n\nconsole.log(validate(schema, data)); // true\n```\n\n### Validating Arrays\n\n```typescript\nconst schema = {\n  users: [\n    {\n      name: \"string\",\n      age: \"number\",\n    },\n  ],\n};\n\nconst data = {\n  users: [\n    { name: \"Alice\", age: 25 },\n    { name: \"Bob\", age: 30 },\n  ],\n};\n\nconsole.log(validate(schema, data)); // true\n```\n\n### Using Optional Properties\n\n```typescript\nconst schema = {\n  type: \"object\",\n  properties: {\n    name: { type: \"string\" },\n    age: { type: \"number\" },\n    address: { type: \"string\", optional: true },\n  },\n};\n\nconst data = {\n  name: \"John\",\n  age: 30,\n};\n\nconsole.log(validate(schema, data)); // true\n```\n\n### Using Constraints (minLength, maxLength, enum)\n\n```typescript\nconst schema = {\n  type: \"string\",\n  enum: [\"red\", \"green\", \"blue\"],\n  minLength: 3,\n  maxLength: 5,\n};\n\nconsole.log(validate(schema, \"red\")); // true\nconsole.log(validate(schema, \"yellow\")); // false\n```\n\n## 📜 API\n\n```typescript\nvalidate(schema: Schema, data: Data): boolean\n```\n\nValidates the provided data against the schema.\n\n- `schema`: The schema defining the expected types and structure of the data.\n- `data`: The data to be validated.\n\nReturns: `true` if the data is valid, or `false` otherwise.\n\n## 🔒️ Requirements\n\n- Node.js version 14.0.0 or higher.\n\n## 🛡️ License\n\nThis project is licensed under the MIT License. See the LICENSE file for more information.\n\n## 👨‍💻 Contribution\n\nFeel free to open issues or submit pull requests to improve jsonweaver. All contributions are welcome! 🌟\n\n1. Fork the repository.\n2. Create a branch for your feature: git checkout -b my-feature.\n3. Make your changes and commit: git commit -m 'My awesome feature'.\n4. Push to the repository: git push origin my-feature.\n5. Open a pull request on GitHub.\n\n## 💡 Author\n\nCreated by Kledenai. Contact me at bruno@khaneland.com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkledenai%2Fjsonverify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkledenai%2Fjsonverify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkledenai%2Fjsonverify/lists"}