{"id":32150765,"url":"https://github.com/undabot/izzyparser-ios","last_synced_at":"2026-02-19T02:02:18.503Z","repository":{"id":42443019,"uuid":"346734359","full_name":"undabot/izzyparser-ios","owner":"undabot","description":"IzzyParser is an iOS library for serializing and deserializing JSON:API objects","archived":false,"fork":false,"pushed_at":"2024-10-28T18:26:32.000Z","size":93,"stargazers_count":20,"open_issues_count":4,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2026-01-20T05:24:56.062Z","etag":null,"topics":["cocoapods","ios","json","json-api","request","response","swift","swift-package-manager","xcode"],"latest_commit_sha":null,"homepage":"","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/undabot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"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}},"created_at":"2021-03-11T14:44:02.000Z","updated_at":"2025-01-30T06:40:10.000Z","dependencies_parsed_at":"2024-05-17T08:51:51.677Z","dependency_job_id":null,"html_url":"https://github.com/undabot/izzyparser-ios","commit_stats":{"total_commits":26,"total_committers":5,"mean_commits":5.2,"dds":0.6923076923076923,"last_synced_commit":"7f360e3e3ea18bc49813ccd687465843638c01b8"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/undabot/izzyparser-ios","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/undabot%2Fizzyparser-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/undabot%2Fizzyparser-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/undabot%2Fizzyparser-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/undabot%2Fizzyparser-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/undabot","download_url":"https://codeload.github.com/undabot/izzyparser-ios/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/undabot%2Fizzyparser-ios/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29600846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T00:59:38.239Z","status":"online","status_checked_at":"2026-02-19T02:00:07.702Z","response_time":117,"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":["cocoapods","ios","json","json-api","request","response","swift","swift-package-manager","xcode"],"created_at":"2025-10-21T10:20:48.001Z","updated_at":"2026-02-19T02:02:18.482Z","avatar_url":"https://github.com/undabot.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IzzyParser iOS\n\nIzzyParser is a library for serializing and deserializing [JSON API](http://jsonapi.org) objects.\n\n![Test](https://github.com/undabot/izzyparser-ios/actions/workflows/ios.yml/badge.svg)\n[![codecov](https://codecov.io/gh/undabot/izzyparser-ios/branch/master/graph/badge.svg?token=RSKJM6G86T)](https://codecov.io/gh/undabot/izzyparser-ios)\n![Platform](https://img.shields.io/cocoapods/p/IzzyParser)\n![Pod version](https://img.shields.io/cocoapods/v/IzzyParser)\n![SPM](https://img.shields.io/badge/SPM-supported-orange)\n![Top language](https://img.shields.io/github/languages/top/undabot/izzyparser-ios)\n![License](https://img.shields.io/github/license/undabot/izzyparser-ios)\n\n## Installation\n\n#### Swift Package Manager\n\n1. Using Xcode 11 or higher go to File \u003e Swift Packages \u003e Add Package Dependency\n2. Paste the project URL: https://github.com/undabot/izzyparser-ios.git\n3. Click on next, select the project target and click finish\n4. `Import IzzyParser`\n\n#### Cocoapods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects\nTo integrate IzzyParser into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\ntarget '\u003cYour Target Name\u003e' do\n    pod 'IzzyParser'\nend\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n\n## Usage\n\n#### Defining resource\n\nAll resources MUST inherit `Resource` class.\n\nBasic resource:\n\n```swift\nclass Author: Resource {\n    \n    override class var type: String {\n        return \"people\"\n    }\n    \n    required init(id: String) {\n        super.init(id: id)\n    }\n}\n```\n\nResource with `customKeys` for serialization and `typesForKeys` for deserialization:\n\n```swift\nclass Article: Resource {\n    @objc var title: String = \"\"\n    @objc var author: Author?\n    @objc var comment: Comment?\n    \n    override class var type: String {\n        return \"articles\"\n    }\n    \n    // Custom coding keys\n    override public class var customKeys: [String: String] {\n        return [\"komentar\": \"comment\"]\n    }\n    \n    override public class var typesForKeys: [String: CustomObject.Type] {\n        return [\"komentar\": Comment.self]\n    }\n    \n    init(id: String, title: String, author: Author, comment: Comment? = nil) {\n        self.title = title\n        self.author = author\n        self.comment = comment\n        super.init(id: id)\n    }\n    \n    required init(id: String) {\n        super.init(id: id)\n    }\n}\n```\n\nObject with custom deserializer:\n\n```swift\n\nclass Comment: NSObject, CustomObject {\n    @objc var id: String\n    @objc var content: String\n    required init(objectJson: [String: Any]) {\n        self.id = objectJson[\"id\"] as? String ?? \"\"\n        self.content = objectJson[\"content\"] as? String ?? \"\"\n    }\n}\n```\n\nCodable custom object:\n\n```swift\n\nclass CodableComment: NSObject, CodableCustomObject {\n    var id: String?\n    var content: String?\n}\n```\n\n\n### Registering resources\n\nAll resources MUST be registered to `Izzy` instance.\n\n```swift\n// Creating resource map\nlet resourceMap: [Resource.Type] = [\n    Article.self,\n    Author.self\n]\n\n// Registering resources\nlet izzy = Izzy()\nizzy.registerResources(resources: resourceMap)\n\n```\n\nDevelopers often forget to register resources to resource map. If resource is not registered, deserializer will return nil for missing object (it is wanted behaviour). But, you can turn on debug mode while developing, so Izzy will throw an error if resource is not registered. \u003cb\u003eDon't enable debug mode for production code because it will cause crashes\u003c/b\u003e, it should be used only for debugging purpose - so that you can detect what resources are not registered.\n\n```swift\n// Registering resources\nlet izzy = Izzy()\nizzy.isDebugModeOn = true\nizzy.registerResources(resources: resourceMap)\n```\n\n### Serializing\n\n#### Serializing single resource: \n\n```swift\n// Article serialization\nlet author = Author(id: \"authorID\")\nlet article = Article(id: \"articleID\", title: \"Article title\", author: author)\n\nlet serializedArticle = izzy.serialize(resource: article)\n```\n\nOutput:\n```swift\n// Serialized article JSON:\n/**\n\t{\n\t  \"data\" : {\n\t    \"attributes\" : {\n\t      \"title\" : \"Article title\"\n\t    },\n\t    \"id\" : \"articleID\",\n\t    \"type\" : \"articles\",\n\t    \"relationships\" : {\n\t      \"author\" : {\n\t        \"data\" : {\n\t          \"id\" : \"authorID\",\n\t          \"type\" : \"people\"\n\t        }\n\t      }\n\t    }\n\t  }\n\t}\n*/\n```\n\n#### Serializing single resource with custom property serialization: \n\n```swift\n// Article serialization with custom author serialization\nlet customRelationshipDict: [String: Any] = [\n    \"name\": \"John\",\n    \"surname\": \"Smith\",\n    \"age\": NSNull()\n]\n\nserializedArticle = izzy.serializeCustom(resource: article, relationshipKey: \"author\", relationshipValue: customRelationshipDict)\n```\n\nOutput: \n```swift\n// Serialized article JSON:\n/**\n\t{\n\t  \"data\" : {\n\t    \"attributes\" : {\n\t      \"title\" : \"Article title\"\n\t    },\n\t    \"id\" : \"articleID\",\n\t    \"type\" : \"articles\",\n\t    \"relationships\" : {\n\t      \"author\" : {\n\t        \"name\" : \"John\",\n\t        \"surname\" : \"Smith\",\n\t        \"age\" : null\n\t      }\n\t    }\n\t  }\n\t}\n*/\n```\n\n#### Serializing resource collection:\n\n```swift\nlet author = Author(id: \"authorID\")\nlet article = Article(id: \"articleID\", title: \"Article title\", author: author)\n\nlet serializedResourceCollection = izzy.serialize(resourceCollection: [article, article])\n```\n\nOutput: \n```swift\n// Serialized resource collection:\n /**\n \t{\n\t  \"data\" : [\n\t    {\n\t      \"attributes\" : {\n\t        \"title\" : \"Article title\"\n\t      },\n\t      \"id\" : \"articleID\",\n\t      \"type\" : \"articles\",\n\t      \"relationships\" : {\n\t        \"author\" : {\n\t          \"data\" : {\n\t            \"id\" : \"authorID\",\n\t            \"type\" : \"people\"\n\t          }\n\t        }\n\t      }\n\t    },\n\t    {\n\t      \"attributes\" : {\n\t        \"title\" : \"Article title\"\n\t      },\n\t      \"id\" : \"articleID\",\n\t      \"type\" : \"articles\",\n\t      \"relationships\" : {\n\t        \"author\" : {\n\t          \"data\" : {\n\t            \"id\" : \"authorID\",\n\t            \"type\" : \"people\"\n\t          }\n\t        }\n\t      }\n\t    }\n\t  ]\n\t}\n */\n```\n\n\n### Deserializing\n\n#### Deserializing single resource: \n\nInput JSON:\n```swift\n// JSON data:\n/**\n\t{\n    \"data\": {\n        \"type\": \"articles\",\n        \"id\": \"1\",\n        \"attributes\": {\n            \"title\": \"Rails is Omakase\",\n            \"komentar\": {\n                \"id\": \"11\",\n                \"content\": \"Custom content\"\n            }\n\n        },\n        \"relationships\": {\n            \"author\": {\n                \"links\": {\n                    \"self\": \"/articles/1/relationships/author\",\n                    \"related\": \"/articles/1/author\"\n                },\n                \"data\": { \"type\": \"people\", \"id\": \"9\" }\n            }\n        }\n    }\n}\n*/\n```\n\n```swift\n// Article deserialization\ndo {\n    let document: Document\u003cArticle\u003e = try izzy.deserializeResource(from: data)\n    let article = document.data\n    \n    let id = article?.id\n} catch let error {\n    print(error.localizedDescription)\n}\n```\n\n#### Deserializing resource collection:\n\n```swift\n// Article deserialization\ndo {\n    let document: Document\u003c[Article]\u003e = try izzy.deserializeCollection(data)\n    let articles = document.data\n} catch let error {\n    print(error.localizedDescription)\n}\n```\n#### Resource with array of custom objects:\n\nInput JSON:\n```swift\n/**\n{\n    \"data\": {\n        \"type\": \"subscription\",\n        \"id\": \"1\",\n        \"attributes\": {\n            \"title\": \"Very nice subscription!\",\n            \"prices\": [{\n                \"type:\": \"monthly\",\n                \"value\": \"1\"\n            },\n            {\n                \"type:\": \"onetime\",\n                \"value\": \"10\"\n            }]\n        }\n    }\n}\n*/\n\n@objcMembers class SubscriptionResource: Resource {\n    \n    var title: String?\n    var prices: [Price]?\n\n    override class var type: String {\n        return \"subscription\"\n    }\n\n    override class var typesForKeys: [String : CustomObject.Type] {\n        return [\"prices\": Price.self]\n    }\n}\n\nstruct Price: Codable {\n    var value: String?\n    var type: String?\n}\n```\n\n## License\nIzzyParser is released under the MIT license. [See LICENSE](https://github.com/undabot/izzyparser-ios/blob/master/LICENSE.md) for details.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fundabot%2Fizzyparser-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fundabot%2Fizzyparser-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fundabot%2Fizzyparser-ios/lists"}