{"id":27194793,"url":"https://github.com/arrangedev/jsonformer-ts","last_synced_at":"2026-02-17T13:31:58.830Z","repository":{"id":270539377,"uuid":"896352251","full_name":"arrangedev/jsonformer-ts","owner":"arrangedev","description":"Structured JSON outputs from LLMs","archived":false,"fork":false,"pushed_at":"2024-12-02T05:11:48.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-20T05:50:39.595Z","etag":null,"topics":["json","llm","transformer","typescript"],"latest_commit_sha":null,"homepage":"","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/arrangedev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2024-11-30T06:00:56.000Z","updated_at":"2024-11-30T17:37:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"4e61b923-93a5-46fc-a288-b52a5cf68577","html_url":"https://github.com/arrangedev/jsonformer-ts","commit_stats":null,"previous_names":["arrangedev/jsonformer-ts"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/arrangedev/jsonformer-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrangedev%2Fjsonformer-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrangedev%2Fjsonformer-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrangedev%2Fjsonformer-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrangedev%2Fjsonformer-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arrangedev","download_url":"https://codeload.github.com/arrangedev/jsonformer-ts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrangedev%2Fjsonformer-ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29545580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T13:00:00.370Z","status":"ssl_error","status_checked_at":"2026-02-17T12:57:14.072Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","llm","transformer","typescript"],"created_at":"2025-04-09T19:36:29.841Z","updated_at":"2026-02-17T13:31:58.805Z","avatar_url":"https://github.com/arrangedev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003ejsonformer-ts\u003c/h1\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ch3\u003eA Typescript port of \u003ca href=\"https://github.com/1rgs/jsonformer\"\u003eJsonformer\u003c/a\u003e.\u003c/h3\u003e\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@arrangedev/jsonformer-ts\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/@arrangedev/jsonformer-ts\"\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://badgen.net/badge/contributions/open/orange\"\u003e\n\u003c/div\u003e\n\n## Overview\nThis is a port of the Jsonformer library originally written in Python. This repo aims to replicate it as close as possible, allowing Typescript developers to take advantage of high-quality structured JSON outputs from language models. \n\nLike the original, the following schema types are supported:\n- number\n- string\n- boolean\n- array\n- object\n\n## Installation\nNPM:\n```bash\nnpm i @arrangedev/jsonformer-ts\n```\n\nyarn:\n```bash\nyarn add @arrangedev/jsonformer-ts\n```\n\n## Example\nHere's a basic example of `jsonformer-ts` in action:\n```Typescript\nasync function main() {\n  console.log(\"Loading model and tokenizer...\");\n  const model = await LlamaForCausalLM.from_pretrained(\n    \"Xenova/TinyLlama-1.1B-Chat-v1.0\",\n    { model_file_name: \"model\" },\n  );\n  const tokenizer = await LlamaTokenizer.from_pretrained(\n    \"Xenova/TinyLlama-1.1B-Chat-v1.0\",\n  );\n\n  const schema = {\n    type: \"object\",\n    properties: {\n      name: { type: \"string\" },\n      age: { type: \"number\" },\n      is_student: { type: \"boolean\" },\n      courses: {\n        type: \"array\",\n        items: { type: \"string\" },\n      },\n    },\n  };\n\n  const prompt =\n    \"Generate a person's information based on the following schema:\";\n\n  console.log(\"Creating Jsonformer instance...\");\n  const jsonformer = new Jsonformer(model, tokenizer, schema, prompt, {\n    debug: true,\n  });\n\n  console.log(\"Generating data...\");\n  const result = await jsonformer.generate();\n\n  console.log(\"\\nGenerated result:\");\n  console.log(JSON.stringify(result, null, 2));\n}\n```\n\nRun the example with:\n```bash\nyarn example:basic\n```\n\n## License\nThis project is MIT licensed, like the original. See [here](https://github.com/1rgs/jsonformer?tab=MIT-1-ov-file#readme) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farrangedev%2Fjsonformer-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farrangedev%2Fjsonformer-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farrangedev%2Fjsonformer-ts/lists"}