{"id":19838212,"url":"https://github.com/oceanpresentchao/ts-json-handler","last_synced_at":"2026-04-28T01:32:36.357Z","repository":{"id":114407381,"uuid":"479438295","full_name":"OceanPresentChao/TS-JSON-Handler","owner":"OceanPresentChao","description":"用typescript手动实现JSON字符串的解析和生成","archived":false,"fork":false,"pushed_at":"2022-04-14T03:31:11.000Z","size":18,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-16T01:41:42.072Z","etag":null,"topics":["json","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/OceanPresentChao.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}},"created_at":"2022-04-08T15:12:08.000Z","updated_at":"2022-04-22T07:38:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"72428265-1529-4738-893d-28950cd8ddb0","html_url":"https://github.com/OceanPresentChao/TS-JSON-Handler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/OceanPresentChao/TS-JSON-Handler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OceanPresentChao%2FTS-JSON-Handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OceanPresentChao%2FTS-JSON-Handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OceanPresentChao%2FTS-JSON-Handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OceanPresentChao%2FTS-JSON-Handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OceanPresentChao","download_url":"https://codeload.github.com/OceanPresentChao/TS-JSON-Handler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OceanPresentChao%2FTS-JSON-Handler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32362781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"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","typescript"],"created_at":"2024-11-12T12:17:03.677Z","updated_at":"2026-04-28T01:32:36.352Z","avatar_url":"https://github.com/OceanPresentChao.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TS-JSON-Handler\n自己用typescript实现的一个JSON解析器和生成器。\n将stringify和parse两个函数都放在了MyJSON类中\n\n## stringify函数\n可以将数组、对象、字符串、布尔、数字、null解析成合法的JSON格式字符串\n\n## parse函数\n可以将JSON合法字符串解析成JSON对象或数组，有着良好的报错提示\n\n### parse函数原理\n主要利用Tokenizer类\n#### 首先进行词法解析：\n使用CharReader类依次读取输入的JSON字符串，将字符串解析成一个个Token（判断特定的字符可知道Token的类型），将所有结果存到Tokenizer的tokenlist中\n#### 然后进行语法解析：\n使用parse函数，对tokenlist进行依次读取，根据当前的Token类型判断接下来预期的Token类型是什么，继续往下读需要判断当前的Token类型是否符合预期。可以判断JSON格式是否合法\n遇到数组和对象类型要进行递归\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foceanpresentchao%2Fts-json-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foceanpresentchao%2Fts-json-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foceanpresentchao%2Fts-json-handler/lists"}