{"id":13612634,"url":"https://github.com/Flight-School/AnyCodable","last_synced_at":"2025-04-13T12:32:17.708Z","repository":{"id":39705867,"uuid":"130725082","full_name":"Flight-School/AnyCodable","owner":"Flight-School","description":"Type-erased wrappers for Encodable, Decodable, and Codable values","archived":true,"fork":false,"pushed_at":"2024-08-06T22:58:24.000Z","size":97,"stargazers_count":1309,"open_issues_count":19,"forks_count":140,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-08T12:27:46.226Z","etag":null,"topics":["codable","decoding","encoding","swift"],"latest_commit_sha":null,"homepage":"https://flight.school/books/codable","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/Flight-School.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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},"funding":{"github":["mattt"],"custom":"https://flight.school/books/codable"}},"created_at":"2018-04-23T16:22:09.000Z","updated_at":"2025-03-30T07:31:47.000Z","dependencies_parsed_at":"2024-01-16T09:55:25.058Z","dependency_job_id":"a5dcf296-62e5-483e-b260-6119839f45ed","html_url":"https://github.com/Flight-School/AnyCodable","commit_stats":{"total_commits":71,"total_committers":17,"mean_commits":4.176470588235294,"dds":0.5211267605633803,"last_synced_commit":"862808b2070cd908cb04f9aafe7de83d35f81b05"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flight-School%2FAnyCodable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flight-School%2FAnyCodable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flight-School%2FAnyCodable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flight-School%2FAnyCodable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Flight-School","download_url":"https://codeload.github.com/Flight-School/AnyCodable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248714649,"owners_count":21149931,"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","decoding","encoding","swift"],"created_at":"2024-08-01T20:00:32.583Z","updated_at":"2025-04-13T12:32:17.360Z","avatar_url":"https://github.com/Flight-School.png","language":"Swift","readme":"# AnyCodable\n\n[![Build Status][build status badge]][build status]\n[![License][license badge]][license]\n[![Swift Version][swift version badge]][swift version]\n![Cocoapods platforms][cocoapods platforms badge]\n[![Cocoapods compatible][cocoapods badge]][cocoapods]\n[![Carthage compatible][carthage badge]][carthage]\n\nType-erased wrappers for `Encodable`, `Decodable`, and `Codable` values.\n\nThis functionality is discussed in Chapter 3 of\n[Flight School Guide to Swift Codable](https://flight.school/books/codable).\n\n## Installation\n\n### Swift Package Manager\n\nAdd the AnyCodable package to your target dependencies in `Package.swift`:\n\n```swift\nimport PackageDescription\n\nlet package = Package(\n  name: \"YourProject\",\n  dependencies: [\n    .package(\n        url: \"https://github.com/Flight-School/AnyCodable\",\n        from: \"0.6.0\"\n    ),\n  ]\n)\n```\n\nThen run the `swift build` command to build your project.\n\n### CocoaPods\n\nYou can install `AnyCodable` via CocoaPods\nby adding the following line to your `Podfile`:\n\n```ruby\npod 'AnyCodable-FlightSchool', '~\u003e 0.6.0'\n```\n\nRun the `pod install` command to download the library\nand integrate it into your Xcode project.\n\n\u003e **Note**\n\u003e The module name for this library is \"AnyCodable\" ---\n\u003e that is, to use it, you add `import AnyCodable` to the top of your Swift code\n\u003e just as you would by any other installation method.\n\u003e The pod is called \"AnyCodable-FlightSchool\"\n\u003e because there's an existing pod with the name \"AnyCodable\".\n\n### Carthage\n\nTo use `AnyCodable` in your Xcode project using Carthage,\nspecify it in `Cartfile`:\n\n```\ngithub \"Flight-School/AnyCodable\" ~\u003e 0.6.0\n```\n\nThen run the `carthage update` command to build the framework,\nand drag the built AnyCodable.framework into your Xcode project.\n\n## Usage\n\n### AnyEncodable\n\n```swift\nimport AnyCodable\n\nlet dictionary: [String: AnyEncodable] = [\n    \"boolean\": true,\n    \"integer\": 1,\n    \"double\": 3.141592653589793,\n    \"string\": \"string\",\n    \"array\": [1, 2, 3],\n    \"nested\": [\n        \"a\": \"alpha\",\n        \"b\": \"bravo\",\n        \"c\": \"charlie\"\n    ],\n    \"null\": nil\n]\n\nlet encoder = JSONEncoder()\nlet json = try! encoder.encode(dictionary)\n```\n\n### AnyDecodable\n\n```swift\nlet json = \"\"\"\n{\n    \"boolean\": true,\n    \"integer\": 1,\n    \"double\": 3.141592653589793,\n    \"string\": \"string\",\n    \"array\": [1, 2, 3],\n    \"nested\": {\n        \"a\": \"alpha\",\n        \"b\": \"bravo\",\n        \"c\": \"charlie\"\n    },\n    \"null\": null\n}\n\"\"\".data(using: .utf8)!\n\nlet decoder = JSONDecoder()\nlet dictionary = try! decoder.decode([String: AnyDecodable].self, from: json)\n```\n\n### AnyCodable\n\n`AnyCodable` can be used to wrap values for encoding and decoding.\n\n## License\n\nMIT\n\n## Contact\n\nMattt ([@mattt](https://twitter.com/mattt))\n\n[build status]: https://github.com/Flight-School/AnyCodable/actions?query=workflow%3ACI\n[build status badge]: https://github.com/Flight-School/AnyCodable/workflows/CI/badge.svg\n[license]: https://opensource.org/licenses/MIT\n[license badge]: https://img.shields.io/cocoapods/l/AnyCodable-FlightSchool.svg\n[swift version]: https://swift.org/download/\n[swift version badge]: https://img.shields.io/badge/swift%20version-5.1+-orange.svg\n[cocoapods platforms badge]: https://img.shields.io/cocoapods/p/AnyCodable-FlightSchool.svg\n[cocoapods]: https://cocoapods.org/pods/AnyCodable-FlightSchool\n[cocoapods badge]: https://img.shields.io/cocoapods/v/AnyCodable-FlightSchool.svg\n[carthage]: https://github.com/Carthage/Carthage\n[carthage badge]: https://img.shields.io/badge/Carthage-compatible-4BC51D.svg\n","funding_links":["https://github.com/sponsors/mattt","https://flight.school/books/codable"],"categories":["HarmonyOS","Swift","swift"],"sub_categories":["Windows Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFlight-School%2FAnyCodable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFlight-School%2FAnyCodable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFlight-School%2FAnyCodable/lists"}