{"id":51174015,"url":"https://github.com/bstr1ckland/json-parser","last_synced_at":"2026-06-27T02:13:52.970Z","repository":{"id":286342251,"uuid":"961120098","full_name":"bstr1ckland/json-parser","owner":"bstr1ckland","description":"A JSON parser built with Python","archived":false,"fork":false,"pushed_at":"2025-04-06T17:21:08.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-03T22:18:41.954Z","etag":null,"topics":["parser","python"],"latest_commit_sha":null,"homepage":"","language":"Python","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/bstr1ckland.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"zenodo":null}},"created_at":"2025-04-05T19:49:19.000Z","updated_at":"2025-04-06T17:21:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"49112449-77d6-4e82-94ae-110fdf0b607d","html_url":"https://github.com/bstr1ckland/json-parser","commit_stats":null,"previous_names":["benstri/json-parser","bstr1ckland/json-parser"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bstr1ckland/json-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bstr1ckland%2Fjson-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bstr1ckland%2Fjson-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bstr1ckland%2Fjson-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bstr1ckland%2Fjson-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bstr1ckland","download_url":"https://codeload.github.com/bstr1ckland/json-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bstr1ckland%2Fjson-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34839552,"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-27T02:00:06.362Z","response_time":126,"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":["parser","python"],"created_at":"2026-06-27T02:13:52.285Z","updated_at":"2026-06-27T02:13:52.965Z","avatar_url":"https://github.com/bstr1ckland.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON Parser\n\nA Python-based JSON parser and scanner that reads tokenized input from `.txt` files, builds a parse tree, and outputs valid JSON or a structured error message.\n\n## 🧠 Features\n\n- Custom scanner to tokenize JSON-like inputs\n- Recursive descent parser\n- Handles objects, arrays, strings, numbers, booleans, and nulls\n- Type validation for arrays (homogeneous elements)\n- Detects and reports:\n  - Invalid tokens\n  - Duplicate keys in objects\n  - Type mismatches in arrays\n  - Malformed numbers and strings\n  - Extra trailing commas\n- Outputs valid `.json` files or JSON-formatted error messages\n\n## 📁 Project Structure\n\n- json_scanner.py | Defines TokenType, Token, and Lexer classes \n- json_parser.py | Main parser logic \n- test0X.txt | Example input files \n- output0X.json | Output files (created after running)\n\n\n## 🧪 Input Format\n\nInput `.txt` files contain pre-tokenized lines. Examples:\n\n```\n\u003c{\u003e \n\u003cstr,\"name\"\u003e \n\u003c:\u003e \n\u003cstr,\"Ben\"\u003e \n\u003c,\u003e \n\u003cstr,\"age\"\u003e \n\u003c:\u003e \n\u003cnum,21\u003e \n\u003c}\u003e\n```\n\n## 🧾 Output Format\n\nOn success:\n```json\n{\n  \"name\": \"Ben\",\n  \"age\": 21\n}\n```\n\nOn error:\n```json\n{\n  \"error\": \"Error type 5 at \\\"name\\\": Duplicate keys found.\"\n}\n```\n\n\n## 🚀 Getting Started\n0. Ensure you have [python3](https://www.python.org/downloads/) installed.\n1. Clone the repo\n```\ngit clone https://github.com/your-username/json-parser.git\ncd json-parser\n```\n2. Adjust test files to your liking in test.00.txt, test.01.txt, etc.\n\n3. Run the parser\n```bash\npython3 json_parser.py\n```\n\n## ⚠️ Error Types\nSpecific Types:\n1.\tMalformed number (starts/ends with a dot)\n2.\tEmpty string\n3.\tNumber starts with + or leading 0\n4.\tReserved words used as strings (e.g. \"true\")\n5.\tDuplicate keys in objects\n6.\tMixed types in arrays\n\nOther:\n- Extra comma\tTrailing commas in arrays or objects\n\n## 📃 License\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbstr1ckland%2Fjson-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbstr1ckland%2Fjson-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbstr1ckland%2Fjson-parser/lists"}