{"id":50732008,"url":"https://github.com/lugondev/format-json-llm","last_synced_at":"2026-06-10T09:32:24.393Z","repository":{"id":363033829,"uuid":"1261709786","full_name":"lugondev/format-json-llm","owner":"lugondev","description":"Convert JSON ↔ TOON and generate JSON Schema + compact TOON schema for LLM prompts. Token-efficient, with live token comparison.","archived":false,"fork":false,"pushed_at":"2026-06-07T04:43:04.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-07T06:20:54.463Z","etag":null,"topics":["converter","json","json-schema","llm","prompt-engineering","schema-generator","token-optimization","toon","vanilla-js","vite"],"latest_commit_sha":null,"homepage":"https://lugondev.github.io/format-json-llm/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lugondev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-07T03:49:00.000Z","updated_at":"2026-06-07T04:43:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lugondev/format-json-llm","commit_stats":null,"previous_names":["lugondev/format-json-llm"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/lugondev/format-json-llm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lugondev%2Fformat-json-llm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lugondev%2Fformat-json-llm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lugondev%2Fformat-json-llm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lugondev%2Fformat-json-llm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lugondev","download_url":"https://codeload.github.com/lugondev/format-json-llm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lugondev%2Fformat-json-llm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34146871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["converter","json","json-schema","llm","prompt-engineering","schema-generator","token-optimization","toon","vanilla-js","vite"],"created_at":"2026-06-10T09:32:23.462Z","updated_at":"2026-06-10T09:32:24.367Z","avatar_url":"https://github.com/lugondev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# format-json-llm\n\nA small JS module + web UI to convert between **JSON** and **TOON**\n([Token-Oriented Object Notation](https://toonformat.dev)) and to generate\n**schemas** (standard JSON Schema + a compact TOON schema) you can paste into an\nLLM prompt so the model understands your request/response format.\n\nTOON is a compact, token-efficient encoding of JSON designed for LLM prompts —\nfewer tokens than JSON for the same data, especially for arrays of objects.\n\n## Features\n\n- **Bidirectional convert:** JSON → TOON and TOON → JSON.\n- **Schema generation:**\n  - JSON Schema (draft 2020-12) inferred from a sample value.\n  - Compact TOON schema, e.g. `users:[]{id:int,name:str}`.\n- **Token comparison:** JSON vs TOON token counts and the percentage saved\n  (via `gpt-tokenizer`).\n- **Live UI:** two-panel editor, debounced realtime conversion, delimiter /\n  indent / strict / keyFolding options, swap source, copy output, and friendly\n  error messages.\n\n## Getting started\n\n```bash\nnpm install\nnpm run dev      # start the Vite dev server\nnpm run build    # production build into dist/\nnpm test         # run the Vitest suite\n```\n\n## Project structure\n\n```\nsrc/\n  core/            # pure logic, zero DOM (unit-tested)\n    toon.js        # jsonToToon / toonToJson (wraps @toon-format/toon)\n    schema-json.js # toJsonSchema -\u003e JSON Schema 2020-12\n    schema-toon.js # toToonSchema -\u003e compact type signature\n    tokens.js      # countTokens / compareTokens\n    index.js       # aggregated core API\n  ui/              # DOM + events\n    panels.js      # builds the shell, output/error/token setters\n    controls.js    # reads encode/decode options, debounce, clipboard\n    app.js         # wiring + render loop\n  main.js          # entry point\ntests/             # Vitest (core unit tests + jsdom UI integration tests)\n```\n\n## Core API\n\n```js\nimport {\n  jsonToToon, toonToJson,\n  toJsonSchema, toToonSchema,\n  countTokens, compareTokens,\n} from './src/core/index.js';\n\njsonToToon(jsonString, opts)  // -\u003e { ok, toon, error }\ntoonToJson(toonString, opts)  // -\u003e { ok, json, value, error }\ntoJsonSchema(value)           // -\u003e JSON Schema object (draft 2020-12)\ntoToonSchema(value)           // -\u003e compact signature string\ncompareTokens(jsonText, toon) // -\u003e { jsonTokens, toonTokens, savedPercent }\n```\n\nEncode/decode options are passed straight through to\n[`@toon-format/toon`](https://www.npmjs.com/package/@toon-format/toon)\n(`delimiter`, `indent`, `keyFolding`, `strict`, `expandPaths`).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flugondev%2Fformat-json-llm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flugondev%2Fformat-json-llm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flugondev%2Fformat-json-llm/lists"}