{"action":"created","issue":{"url":"https://api.github.com/repos/Hearst-DD/ObjectMapper/issues/327","labels_url":"https://api.github.com/repos/Hearst-DD/ObjectMapper/issues/327/labels{/name}","comments_url":"https://api.github.com/repos/Hearst-DD/ObjectMapper/issues/327/comments","events_url":"https://api.github.com/repos/Hearst-DD/ObjectMapper/issues/327/events","html_url":"https://github.com/Hearst-DD/ObjectMapper/issues/327","id":121769271,"number":327,"title":"Decoupling json into multiple objects","user":{"login":"piresbruno","id":3534606,"avatar_url":"https://avatars.githubusercontent.com/u/3534606?v=3","gravatar_id":"","url":"https://api.github.com/users/piresbruno","html_url":"https://github.com/piresbruno","followers_url":"https://api.github.com/users/piresbruno/followers","following_url":"https://api.github.com/users/piresbruno/following{/other_user}","gists_url":"https://api.github.com/users/piresbruno/gists{/gist_id}","starred_url":"https://api.github.com/users/piresbruno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piresbruno/subscriptions","organizations_url":"https://api.github.com/users/piresbruno/orgs","repos_url":"https://api.github.com/users/piresbruno/repos","events_url":"https://api.github.com/users/piresbruno/events{/privacy}","received_events_url":"https://api.github.com/users/piresbruno/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-11T18:54:04Z","updated_at":"2015-12-11T19:47:09Z","closed_at":"2015-12-11T19:03:16Z","body":"Is it possible, from the same json object hierarchy, create map where one object is a property type in the other?\r\nThis is a simplistic approach to demonstrate my problem:\r\n\r\n#### Json example\r\n```\r\n{\r\n\t\"id\" : \"ewgerngortqerw_ret?$njbsd\",\r\n\t\"name\" : \"test_user\",\r\n\t\"email\" : \"xpto@xpto.com\",\r\n\t\"promotional_code\" : \"AHFJKLMNFDLKJ500\",\r\n\t\"promotional_value\" : 350\r\n} \r\n```\r\n  \r\nI want to map three properties of the json response into an User object, and the remaining two properties to a child User object property, called userPromotions, of type Promotion\r\n\r\n```\r\nclass Promotion: Mappable {\r\n    var value:String?\r\n    var code:String?\r\n    \r\n    required init?(_ map:Map){}\r\n    \r\n    func mapping(map: Map) {\r\n        value   <- map[\"promotional_value\"]\r\n        code    <- map[\"promotional_code\"]\r\n    }\r\n}\r\n\r\nclass User: Mappable {\r\n    var id:String?\r\n    var name:String?\r\n    var email:String?\r\n    var userPromotions:Promotion?\r\n    \r\n    required init?(_ map:Map){}\r\n    \r\n    func mapping(map: Map) {\r\n        id      <- map[\"id\"]\r\n        name    <- map[\"name\"]\r\n        email   <- map[\"email\"]\r\n        \r\n        // how to handle this??\r\n        userPromotions <- map[\"????\"]\r\n    }\r\n}\r\n```\r\n\r\nIs this possible with ObjectMapper?"},"comment":{"url":"https://api.github.com/repos/Hearst-DD/ObjectMapper/issues/comments/164032123","html_url":"https://github.com/Hearst-DD/ObjectMapper/issues/327#issuecomment-164032123","issue_url":"https://api.github.com/repos/Hearst-DD/ObjectMapper/issues/327","id":164032123,"user":{"login":"tristanhimmelman","id":1562134,"avatar_url":"https://avatars.githubusercontent.com/u/1562134?v=3","gravatar_id":"","url":"https://api.github.com/users/tristanhimmelman","html_url":"https://github.com/tristanhimmelman","followers_url":"https://api.github.com/users/tristanhimmelman/followers","following_url":"https://api.github.com/users/tristanhimmelman/following{/other_user}","gists_url":"https://api.github.com/users/tristanhimmelman/gists{/gist_id}","starred_url":"https://api.github.com/users/tristanhimmelman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tristanhimmelman/subscriptions","organizations_url":"https://api.github.com/users/tristanhimmelman/orgs","repos_url":"https://api.github.com/users/tristanhimmelman/repos","events_url":"https://api.github.com/users/tristanhimmelman/events{/privacy}","received_events_url":"https://api.github.com/users/tristanhimmelman/received_events","type":"User","site_admin":false},"created_at":"2015-12-11T19:47:09Z","updated_at":"2015-12-11T19:47:09Z","body":"No it's not in the documentation at the moment..."}}