{"id":18270496,"url":"https://github.com/jamztang/JTObjectMapping","last_synced_at":"2025-04-05T01:30:38.624Z","repository":{"id":56916558,"uuid":"2333464","full_name":"jamztang/JTObjectMapping","owner":"jamztang","description":"A very simple objective-c framework that maps a JSON response from NSDictionary or NSArray to an NSObject subclass for iOS.","archived":false,"fork":false,"pushed_at":"2016-01-15T08:01:53.000Z","size":130,"stargazers_count":264,"open_issues_count":9,"forks_count":56,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-03-30T09:06:50.967Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/jamztang.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":"2011-09-06T09:11:32.000Z","updated_at":"2024-12-11T03:32:56.000Z","dependencies_parsed_at":"2022-08-20T21:20:18.391Z","dependency_job_id":null,"html_url":"https://github.com/jamztang/JTObjectMapping","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamztang%2FJTObjectMapping","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamztang%2FJTObjectMapping/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamztang%2FJTObjectMapping/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamztang%2FJTObjectMapping/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamztang","download_url":"https://codeload.github.com/jamztang/JTObjectMapping/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276022,"owners_count":20912285,"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":[],"created_at":"2024-11-05T11:38:40.699Z","updated_at":"2025-04-05T01:30:37.948Z","avatar_url":"https://github.com/jamztang.png","language":"Objective-C","readme":"JTObjectMapping\n===============\n\nInspired by RestKit. A very simple objective-c framework that maps a JSON response from NSDictionary or NSArray to NSObject subclasses for iOS.\n\nInstall\n-------\n\n### Original method\n\nCopy all files in JTObjectMapping/ into your project.\n\n### CocoaPods\n\n`$ pod search JTObjectMapping`, you should be able to specify the right version in your Podfile. Here's more information about [CocoaPods][].\n\nUsage\n-----\nSuppose this is a JSON User object response represented in NSDictionary after parsing\n\u003cpre\u003e\n{\n    \"create_date\" = \"1970-01-01T00:00:00+0000\";\n    \"p_age\" = 30;\n    \"p_childs\" =     (\n        Mary,\n        James\n    );\n    \"p_name\" = Bob;\n    \"p_title\" = Manager;\n    \"social_networks\" = {\n        \"twitter\" = \"@mystcolor\";\n        \"facebook\" = \"yourFacebookID\";\n    }\n}\n\u003c/pre\u003e\n\nGet ready with your JSON use **[NSObject objectFromJSONObject:json mapping:mapping]** to convert.\n\n    ...\n    NSDictionary *json = \u003cParsed JSON response from above\u003e;\n\n    //\n    // Use +[NSObject objectFromJSONObject:mapping:] to convert \n    // the NSDictionary into your JTUserTest object\n    //\n    JTUserTest *user = [JTUserTest objectFromJSONObject:json mapping:mapping];\n    ...\n\nDefine necessary mappings, from a dictionary key to a property keyPath.\n\n    // Define the mapping of a nested custom object - JTSocialNetworkTest\n    NSDictionary *socialNetworkMapping = [NSDictionary dictionaryWithObjectsAndKeys:\n                                               @\"twitterID\", @\"twitter\",\n                                               @\"facebookID\", @\"facebook\",\n                                           nil];\n\n    NSDictionary *mapping = [NSDictionary dictionaryWithObjectsAndKeys:\n                    @\"name\", @\"p_name\",\n                    @\"title\", @\"p_title\",\n                    @\"age\", @\"p_age\",\n                    @\"childs\", @\"p_childs\",                    \n                    [NSDate mappingWithKey:@\"createDate\"\n                          dateFormatString:@\"yyyy-MM-dd'T'HH:mm:ssZ\"], @\"create_date\",\n                    [JTSocialNetworkTest mappingWithKey:@\"socialNetwork\"\n                                                mapping:socialNetworkMapping], @\"social_networks\",\n                    nil];\n\n\nOf course you need to define your own User object with corresponding @synthesize properties, and thats all for what you need.\n\n\n    // JTSocialNetworkTest.h\n\n    @interface JTSocialNetworkTest\n    @property (nonatomic, copy) NSString *twitter;\n    @property (nonatomic, copy) NSString *facebook;\n    @end\n\n    // JTSocialNetworkTest.m\n    @implementation\n    @end\n\n    // JTUserTest.h\n    \n    @interface JTUserTest : NSObject\n    \n    @property (nonatomic, copy) NSString *name;\n    @property (nonatomic, copy) NSString *title;\n    @property (nonatomic, copy) NSNumber *age;\n    @property (nonatomic, strong) NSDate *createDate;\n    @property (nonatomic, strong) NSArray *childs;\n    @property (nonatomic, strong) JTSocialNetworkTest *socialNetwork;\n    \n    @end\n    \n    // JTUserTest.m\n    #import \"JTUserTest.h\"\n    \n    @implementation JTUserTest\n    @end\n\nFor more detailed usage, see **JTObjectMappingTests.m**, will be adding more detailed description soon.\n\nUpdate Logs\n-----------\n\nv1.1.2\n- Added auto mapping from underscores to CamelCases (e.g. full\\_name -\u003e fullName)\n\nv1.1.1\n- Added URL support, thanks to [@TheSantaClaus][] and adding the test\n  cases nicely.\n\nv1.1\n- Refactored JTObjectMapping. Now extending custom mappings are much more cleaner.\n- Proper keyPath support.\n\nv1.0.7\n- Added JTSetMapping and JTDateEpochMappings, thanks to [@zcharter][] for making this happen!\n\nv1.0.6\n- Added experimental keypath support. use `#define JTOBJECTMAPPING_DISABLE_KEYPATH_SUPPORT = 1` to disable it.\n\nv1.0.5  \n- Fixed nested array causing crash\n\nv1.0.4  \n- Added auto NSDictionary value to NSObject property mapping with the same key defined  \n- Fixed false possible JSON response in NSArray use case\n\nv1.0.3   \n- Add raw array JSON response support\n\nv1.0.2   \n- Added NSArray support\n\nv1.0.1  \n- Added NSDate support for mappings\n\n\n[CocoaPods]:https://github.com/CocoaPods/CocoaPods\n[@zcharter]:https://github.com/zcharter\n[@TheSantaClaus]:https://github.com/TheSantaClaus\n\n\n\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/jamztang/jtobjectmapping/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n","funding_links":[],"categories":["etc"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamztang%2FJTObjectMapping","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamztang%2FJTObjectMapping","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamztang%2FJTObjectMapping/lists"}