{"id":15946034,"url":"https://github.com/swissmanu/spicery","last_synced_at":"2025-10-19T06:30:28.034Z","repository":{"id":20045958,"uuid":"76356428","full_name":"swissmanu/spicery","owner":"swissmanu","description":"Runtime type safety for JSON/untyped data.","archived":false,"fork":false,"pushed_at":"2023-01-07T04:11:18.000Z","size":1166,"stargazers_count":37,"open_issues_count":9,"forks_count":1,"subscribers_count":5,"default_branch":"develop","last_synced_at":"2025-01-29T06:17:33.651Z","etag":null,"topics":["json","parser","runtime","typesafe","typescript"],"latest_commit_sha":null,"homepage":"https://swissmanu.github.io/spicery","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/swissmanu.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}},"created_at":"2016-12-13T12:23:22.000Z","updated_at":"2025-01-18T14:25:04.000Z","dependencies_parsed_at":"2023-01-14T00:15:15.477Z","dependency_job_id":null,"html_url":"https://github.com/swissmanu/spicery","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swissmanu%2Fspicery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swissmanu%2Fspicery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swissmanu%2Fspicery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swissmanu%2Fspicery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swissmanu","download_url":"https://codeload.github.com/swissmanu/spicery/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237024035,"owners_count":19242700,"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","parser","runtime","typesafe","typescript"],"created_at":"2024-10-07T09:10:00.775Z","updated_at":"2025-10-19T06:30:27.551Z","avatar_url":"https://github.com/swissmanu.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spicery\n\n\u003e Runtime type safety for JSON/untyped data.\n\n[TypeScript](https://www.typescriptlang.org/) gives you compile-time type safety for your JavaScript code. External data which you get through, for example, XHR calls is only checkable at runtime. `spicery` allows you to handle runtime checks in one place using an easy to use API.\n\n[![npm version](https://badge.fury.io/js/spicery.svg)](https://badge.fury.io/js/spicery) [![Build Status](https://travis-ci.org/swissmanu/spicery.svg?branch=master)](https://travis-ci.org/swissmanu/spicery) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n\n## Examples\n\n```typescript\n// You know TypeScript Interfaces:\ninterface Todo { userId: number; id: number; title: string; completed: boolean; }\n\n// This is new: Define a Todo Parser with spicery:\nconst todos: ParserFn\u003cTodo\u003e = x =\u003e ({\n  userId:    fromMap(x, 'userId', aNumber),\n  id:        fromMap(x, 'id', aNumber),\n  title:     fromMap(x, 'title', aString),\n  completed: fromMap(x, 'completed', aBoolean)\n});\n\n// Define another Parser for an Array containing Todos using spicery array parser:\nconst jsonplaceholderTodos = anArrayContaining(todos);\n\n// Fetch Todos and parse them:\nwindow.fetch('https://jsonplaceholder.typicode.com/todos')\n  .then(r =\u003e parse(jsonPlaceholderTodos)(r.body))\n  .then(t =\u003e console.log(t))\n```\n\nFor further examples refer to the `examples/` directory. To execute them locally, clone this repository and run following commands on your command line of choice:\n\n```bash\nyarn\nyarn run example:simple\nyarn run example:complex\n```\n\n*Though the first `yarn` command is only used to install any module dependencies once* 🤓\n\n## Contribution\n\nThe `master` branch contains the latest stable release.\nDevelopment efforts are integrated with the `develop` branch first. Changes get then merged into `master` as soon as a new release should be published.\n\nWhen opening a new Pull Request make sure you point them to `develop`. Make use of proper commit messages: `spicery` loves [Commitizen](http://commitizen.github.io/cz-cli/), so take a look there and use `git cz` for the most simple workflow :-)\n\nThank you for your contribution!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswissmanu%2Fspicery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswissmanu%2Fspicery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswissmanu%2Fspicery/lists"}