{"id":20270968,"url":"https://github.com/swiftdo/json","last_synced_at":"2025-10-28T19:32:44.532Z","repository":{"id":133784167,"uuid":"356104573","full_name":"swiftdo/json","owner":"swiftdo","description":"码了个 swift json 解析器","archived":false,"fork":false,"pushed_at":"2021-04-21T00:36:56.000Z","size":101,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T02:37:06.165Z","etag":null,"topics":["json","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/swiftdo.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":"2021-04-09T02:06:15.000Z","updated_at":"2024-06-26T07:28:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"7ae70e14-38f6-4990-8faa-4e3993ce3502","html_url":"https://github.com/swiftdo/json","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftdo%2Fjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftdo%2Fjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftdo%2Fjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftdo%2Fjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swiftdo","download_url":"https://codeload.github.com/swiftdo/json/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248340370,"owners_count":21087438,"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","swift"],"created_at":"2024-11-14T12:35:21.697Z","updated_at":"2025-10-28T19:32:44.442Z","avatar_url":"https://github.com/swiftdo.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swiftdo/json\n\nswift json 解析库\n\n* [x] 完成 json 打印\n* [x] 完成 json 解析\n\n## 实现文章\n* [Swift 码了个 JSON 解析器(一)](https://oldbird.run/swift/fp/t3-json1.html)\n* [Swift 码了个 JSON 解析器(二)](https://oldbird.run/swift/fp/t3-json2.html)\n* [Swift 码了个 JSON 解析器(三)](https://oldbird.run/swift/fp/t3-json3.html)\n\n## 使用 \n\n```swift\nlet str = \"{  \\\"a\\\":[8,9,10],\\\"c\\\":{\\\"temp\\\":true,\\\"say\\\":\\\"hello\\\",\\\"name\\\":\\\"world\\\"},   \\\"b\\\":10.2}\"\n\nprint(\"json 字符串::\\n\\(str) \\n\")\n\ndo {\n    // 解析 json 字符串\n    let result = try parseJson(str: str)\n    print(\"\\n返回结果::\")\n    // 格式化 json 字符串\n    print(prettyJson(json: result))\n} catch  {\n    print(error)\n}\n```\n\n结果输出：\n\n```json\njson 字符串::\n{  \"a\":[8,9,10],\"c\":{\"temp\":true,\"say\":\"hello\",\"name\":\"world\"},   \"b\":10.2} \n\n\n返回结果::\n{\n    \"a\":[\n        8,\n        9,\n        10\n    ],\n    \"c\":{\n        \"temp\":true,\n        \"say\":\"hello\",\n        \"name\":\"world\"\n    },\n    \"b\":10.2\n}\n```\n\n\n## 参考:\n\n* [150行Haskell代码实现JSON的解析和格式化，诗一样的代码](https://zhuanlan.zhihu.com/p/359406047)\n* [半小时实现一个 JSON 解析器](https://zhuanlan.zhihu.com/p/28049617)\n* [自己动手实现一个简单的JSON解析器](https://segmentfault.com/a/1190000010998941)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftdo%2Fjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswiftdo%2Fjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftdo%2Fjson/lists"}