{"id":15293672,"url":"https://github.com/yutomizutani/jsontocodable","last_synced_at":"2025-07-11T22:06:28.255Z","repository":{"id":56916528,"uuid":"149593906","full_name":"YutoMizutani/JSONtoCodable","owner":"YutoMizutani","description":"A generating tool from Raw JSON to Codable (Swift4) text written in Swift4.","archived":false,"fork":false,"pushed_at":"2018-11-17T03:32:45.000Z","size":5312,"stargazers_count":37,"open_issues_count":5,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-14T13:03:12.629Z","etag":null,"topics":["codable","converter","generator","json","swift","swift4"],"latest_commit_sha":null,"homepage":null,"language":"Swift","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/YutoMizutani.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}},"created_at":"2018-09-20T10:43:27.000Z","updated_at":"2023-08-27T19:36:59.000Z","dependencies_parsed_at":"2022-08-21T03:50:52.232Z","dependency_job_id":null,"html_url":"https://github.com/YutoMizutani/JSONtoCodable","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/YutoMizutani/JSONtoCodable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YutoMizutani%2FJSONtoCodable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YutoMizutani%2FJSONtoCodable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YutoMizutani%2FJSONtoCodable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YutoMizutani%2FJSONtoCodable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YutoMizutani","download_url":"https://codeload.github.com/YutoMizutani/JSONtoCodable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YutoMizutani%2FJSONtoCodable/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264904424,"owners_count":23681203,"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":["codable","converter","generator","json","swift","swift4"],"created_at":"2024-09-30T16:50:28.776Z","updated_at":"2025-07-11T22:06:28.233Z","avatar_url":"https://github.com/YutoMizutani.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![JSONtoCodable](https://github.com/YutoMizutani/JSONtoCodable/blob/media/media/logo_text.png?raw=true)\n\n[![Build Status](https://app.bitrise.io/app/869daca1801a29aa/status.svg?token=9lhf2DEdWQhg6AUaUqGXAA\u0026branch=develop)](https://app.bitrise.io/app/869daca1801a29aa)\n[![CocoaPods](https://img.shields.io/cocoapods/p/JSONtoCodable.svg)](https://github.com/YutoMizutani/JSONtoCodable)\n[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/YutoMizutani/JSONtoCodable/blob/master/LICENSE)\n[![CocoaPods](https://img.shields.io/cocoapods/v/JSONtoCodable.svg)](https://github.com/YutoMizutani/JSONtoCodable)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/YutoMizutani/JSONtoCodable)\n[![codecov](https://codecov.io/gh/YutoMizutani/JSONtoCodable/branch/master/graph/badge.svg)](https://codecov.io/gh/YutoMizutani/JSONtoCodable)\n\n**JSONtoCodable** is a generating tool from Raw JSON to Codable (Swift4) text written in Swift4.\n\nQiita: [JSONからCodable化されたstructを自動生成するツールを作った話 - Qiita](https://qiita.com/YutoMizutani/items/106cae55091f26bba641)\n\n![demo_macos.png](https://raw.githubusercontent.com/YutoMizutani/JSONtoCodable/media/media/demo_macos.png)\n\n## TL;DR\n\nFrom JSON,\n\n```json\n{\n    \"user\": {\n        \"Name\": \"Yuto Mizutani\"\n    },\n    \"lib\": {\n        \"lib-name\": \"JSONtoCodable\",\n        \"year\": 2018,\n        \"version\": \"1.0.2\",\n        \"released\": \"2018-09-22\"\n    },\n    \"text\": \"Hello, world!!\"\n}\n```\n\nto Codable.\n\n```swift\npublic struct Result: Codable {\n    public let user: User\n    public let lib: Lib\n    public let text: String\n\n    public struct User: Codable {\n        public let name: String\n\n        private enum CodingKeys: String, CodingKey {\n            case name = \"Name\"\n        }\n    }\n\n    public struct Lib: Codable {\n        public let libName: String\n        public let year: Int\n        public let version: String\n        public let released: String\n\n        private enum CodingKeys: String, CodingKey {\n            case libName = \"lib-name\"\n            case year\n            case version\n            case released\n        }\n    }\n}\n```\n\n## [JaCo (macOS App)](https://github.com/YutoMizutani/JSONtoCodable/tree/master/Apps/JaCo)\n\n![demo_macos.png](https://raw.githubusercontent.com/YutoMizutani/JSONtoCodable/media/media/demo_macos.png)\n\n## [jc (CLI App)](https://github.com/YutoMizutani/JSONtoCodable/tree/master/Apps/jc)\n\n### Installation\n\n```\n$ brew tap YutoMizutani/jc\n$ brew install jc\n```\n\n### Usage example\n\n```\n$ curl https://httpbin.org/get | jc\n```\n\nor generate *.swift* file,\n\n```\n$ curl https://httpbin.org/get | jc \u003e Result.swift\n```\n\n### Help command\n\n```\n$ jc -h\n```\n\n### Screen shot\n\n![demo_cli.png](https://raw.githubusercontent.com/YutoMizutani/JSONtoCodable/media/media/demo_cli.png)\n\n## Support formats\n\n- Type\n\t- String\n\t- Bool\n\t- Int\n\t- Double\n\t- struct(s)\n\t- Optional\u003cT\u003e\n- Array\n\t- Start array\n\t- Muptiple array\n\t- Arrayed objects\n\t- Optional array\n- Number of nested array and objects\n\t- Infinity\n- Number of spaces in entered JSON\n\t- 0 to infinity\n\n## Translations\n\n|JSON Value|Swift Type|\n|:-:|:-:|\n|\"text\"|String|\n|true|Bool|\n|-10|Int|\n|1.0|Double|\n|null|\\\u003cFoo\\\u003e?|\n|(the others)|Any|\n\n## Usage\n\n```swift\nimport JSONtoCodable\n\nlet json: String = \"\"\"\n{\n    \"Hello\": \"Hello, world!!\"\n}\n\"\"\"\n\nlet jsonToCodable = JSONtoCodable()\nlet codable = try? jsonToCodable.generate(json)\n\nprint(codable)\n/*\nstruct Result: Codable {\n    let hello: String\n\n    private enum CodingKeys: String, CodingKey {\n        case hello = \"Hello\"\n    }\n}\n*/\n```\n\n## Config\n\n```swift\nlet config = Config()\nconfig.name = \"Result\" // struct Result: Codable {}\nconfig.accessModifier = AccessModifier.public // public struct\nconfig.caseType = (variable: CaseType.camel, struct: CaseType.pascal)\nconfig.lineType = LineType.lineFeed\nconfig.indentType = IndentType.space(4)\n```\n\n[See more: Config.swift](https://github.com/YutoMizutani/JSONtoCodable/blob/master/Sources/Core/Config.swift)\n\n## Installation\n\n#### Cocoapods\n\nAdd this to your Podfile:\n\n```\npod 'JSONtoCodable'\n```\n\nand\n\n```\n$ pod install\n```\n\n#### Carthage\n\nAdd this to your Cartfile:\n\n```\ngithub \"YutoMizutani/JSONtoCodable\"\n```\n\nand\n\n```\n$ carthage update\n```\n\n## License\n\nJSONtoCodable is available under the [MIT license](https://github.com/YutoMizutani/JSONtoCodable/blob/master/LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyutomizutani%2Fjsontocodable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyutomizutani%2Fjsontocodable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyutomizutani%2Fjsontocodable/lists"}