{"action":"created","issue":{"url":"https://api.github.com/repos/ocombe/ng2-translate/issues/47","repository_url":"https://api.github.com/repos/ocombe/ng2-translate","labels_url":"https://api.github.com/repos/ocombe/ng2-translate/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/ocombe/ng2-translate/issues/47/comments","events_url":"https://api.github.com/repos/ocombe/ng2-translate/issues/47/events","html_url":"https://github.com/ocombe/ng2-translate/issues/47","id":137207900,"number":47,"title":"parser.flattenObject is called too often","user":{"login":"ribizli","id":1018713,"avatar_url":"https://avatars.githubusercontent.com/u/1018713?v=3","gravatar_id":"","url":"https://api.github.com/users/ribizli","html_url":"https://github.com/ribizli","followers_url":"https://api.github.com/users/ribizli/followers","following_url":"https://api.github.com/users/ribizli/following{/other_user}","gists_url":"https://api.github.com/users/ribizli/gists{/gist_id}","starred_url":"https://api.github.com/users/ribizli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ribizli/subscriptions","organizations_url":"https://api.github.com/users/ribizli/orgs","repos_url":"https://api.github.com/users/ribizli/repos","events_url":"https://api.github.com/users/ribizli/events{/privacy}","received_events_url":"https://api.github.com/users/ribizli/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ocombe/ng2-translate/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-29T10:08:05Z","updated_at":"2016-02-29T15:32:22Z","closed_at":null,"body":"As the language definition JSON object can get complex, it is a performance penalty to always flatten this JSON, any time a ```translate.get``` (or ```translate.instant```) is called.\r\n\r\nI'd recommend the other way: parsing the key (split by dot) and try to address the JSON field recursively.\r\n\r\nE.g. (just a dummy demonstration): \r\n```\r\nlet key = 'keyA.keyB.keyC';\r\nlet keys = key.split('.');\r\nlet value;\r\ntry {\r\n  value = obj;\r\n  for (let i = 0; i < keys.length; i++) {\r\n    value = value[key[i]];\r\n  }\r\n} catch (e) {\r\n  value = '!!!not found';\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/ocombe/ng2-translate/issues/comments/190258113","html_url":"https://github.com/ocombe/ng2-translate/issues/47#issuecomment-190258113","issue_url":"https://api.github.com/repos/ocombe/ng2-translate/issues/47","id":190258113,"user":{"login":"ocombe","id":265378,"avatar_url":"https://avatars.githubusercontent.com/u/265378?v=3","gravatar_id":"","url":"https://api.github.com/users/ocombe","html_url":"https://github.com/ocombe","followers_url":"https://api.github.com/users/ocombe/followers","following_url":"https://api.github.com/users/ocombe/following{/other_user}","gists_url":"https://api.github.com/users/ocombe/gists{/gist_id}","starred_url":"https://api.github.com/users/ocombe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocombe/subscriptions","organizations_url":"https://api.github.com/users/ocombe/orgs","repos_url":"https://api.github.com/users/ocombe/repos","events_url":"https://api.github.com/users/ocombe/events{/privacy}","received_events_url":"https://api.github.com/users/ocombe/received_events","type":"User","site_admin":false},"created_at":"2016-02-29T15:32:22Z","updated_at":"2016-02-29T15:32:22Z","body":"Ahh nice, I didn't know that one.\r\nWhen I have the time I'll add a plunkr that people can fork for issues, I'll use that, thanks."}}