{"action":"opened","number":9,"pull_request":{"url":"https://api.github.com/repos/danielcrenna/json/pulls/9","id":50383954,"html_url":"https://github.com/danielcrenna/json/pull/9","diff_url":"https://github.com/danielcrenna/json/pull/9.diff","patch_url":"https://github.com/danielcrenna/json/pull/9.patch","issue_url":"https://api.github.com/repos/danielcrenna/json/issues/9","number":9,"state":"open","locked":false,"title":"Converting JsonObject to static types","user":{"login":"baSSiLL","id":1926484,"avatar_url":"https://avatars.githubusercontent.com/u/1926484?v=3","gravatar_id":"","url":"https://api.github.com/users/baSSiLL","html_url":"https://github.com/baSSiLL","followers_url":"https://api.github.com/users/baSSiLL/followers","following_url":"https://api.github.com/users/baSSiLL/following{/other_user}","gists_url":"https://api.github.com/users/baSSiLL/gists{/gist_id}","starred_url":"https://api.github.com/users/baSSiLL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baSSiLL/subscriptions","organizations_url":"https://api.github.com/users/baSSiLL/orgs","repos_url":"https://api.github.com/users/baSSiLL/repos","events_url":"https://api.github.com/users/baSSiLL/events{/privacy}","received_events_url":"https://api.github.com/users/baSSiLL/received_events","type":"User","site_admin":false},"body":"This may be useful when type for some part of JSON content is not known in advance. They can be represented with **IDictionary<string, object>** properties and converted to a static type when it is known.\r\n\r\n    class Command\r\n    {\r\n        string Name { get; set; }\r\n        IDictionary<string, object> Arguments { get; set; }\r\n        public T ConvertArguments<T>()\r\n        {\r\n            return new JsonObject(Arguments).Convert<T>();\r\n        }\r\n    }\r\n\r\n    ...\r\n    var command = JsonParser.Deserialize<Command>(jsonStr);\r\n    switch (command.Name)\r\n    {\r\n        case \"start\": \r\n            ExecStartCommand(command.ConvertArguments<StartArguments>());\r\n            break;\r\n        case \"stop\": \r\n            ExecStopCommand(command.ConvertArguments<StopArguments>());\r\n            break;\r\n    }\r\n\r\nAlso, consider making public the new overloads of **Deserialize** method (with **bag** parameter) to eliminate the need of intermediate **JsonObject** and to support such scenarios in .NET 3.5.","created_at":"2015-11-11T13:39:29Z","updated_at":"2015-11-11T13:39:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1d8eb2a6f4ad74ae8b2829aa55e3405e2e09de88","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/danielcrenna/json/pulls/9/commits","review_comments_url":"https://api.github.com/repos/danielcrenna/json/pulls/9/comments","review_comment_url":"https://api.github.com/repos/danielcrenna/json/pulls/comments{/number}","comments_url":"https://api.github.com/repos/danielcrenna/json/issues/9/comments","statuses_url":"https://api.github.com/repos/danielcrenna/json/statuses/f7f080ac593ec4fe9048b8c54528daee0cafd747","head":{"label":"baSSiLL:master","ref":"master","sha":"f7f080ac593ec4fe9048b8c54528daee0cafd747","user":{"login":"baSSiLL","id":1926484,"avatar_url":"https://avatars.githubusercontent.com/u/1926484?v=3","gravatar_id":"","url":"https://api.github.com/users/baSSiLL","html_url":"https://github.com/baSSiLL","followers_url":"https://api.github.com/users/baSSiLL/followers","following_url":"https://api.github.com/users/baSSiLL/following{/other_user}","gists_url":"https://api.github.com/users/baSSiLL/gists{/gist_id}","starred_url":"https://api.github.com/users/baSSiLL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baSSiLL/subscriptions","organizations_url":"https://api.github.com/users/baSSiLL/orgs","repos_url":"https://api.github.com/users/baSSiLL/repos","events_url":"https://api.github.com/users/baSSiLL/events{/privacy}","received_events_url":"https://api.github.com/users/baSSiLL/received_events","type":"User","site_admin":false},"repo":{"id":45867771,"name":"json","full_name":"baSSiLL/json","owner":{"login":"baSSiLL","id":1926484,"avatar_url":"https://avatars.githubusercontent.com/u/1926484?v=3","gravatar_id":"","url":"https://api.github.com/users/baSSiLL","html_url":"https://github.com/baSSiLL","followers_url":"https://api.github.com/users/baSSiLL/followers","following_url":"https://api.github.com/users/baSSiLL/following{/other_user}","gists_url":"https://api.github.com/users/baSSiLL/gists{/gist_id}","starred_url":"https://api.github.com/users/baSSiLL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baSSiLL/subscriptions","organizations_url":"https://api.github.com/users/baSSiLL/orgs","repos_url":"https://api.github.com/users/baSSiLL/repos","events_url":"https://api.github.com/users/baSSiLL/events{/privacy}","received_events_url":"https://api.github.com/users/baSSiLL/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/baSSiLL/json","description":"A public-domain JSON parser written in C#. Supports dynamic deserialization in .NET 4.0, and runs on every .NET platform. Open specs and standards should be free.","fork":true,"url":"https://api.github.com/repos/baSSiLL/json","forks_url":"https://api.github.com/repos/baSSiLL/json/forks","keys_url":"https://api.github.com/repos/baSSiLL/json/keys{/key_id}","collaborators_url":"https://api.github.com/repos/baSSiLL/json/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/baSSiLL/json/teams","hooks_url":"https://api.github.com/repos/baSSiLL/json/hooks","issue_events_url":"https://api.github.com/repos/baSSiLL/json/issues/events{/number}","events_url":"https://api.github.com/repos/baSSiLL/json/events","assignees_url":"https://api.github.com/repos/baSSiLL/json/assignees{/user}","branches_url":"https://api.github.com/repos/baSSiLL/json/branches{/branch}","tags_url":"https://api.github.com/repos/baSSiLL/json/tags","blobs_url":"https://api.github.com/repos/baSSiLL/json/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/baSSiLL/json/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/baSSiLL/json/git/refs{/sha}","trees_url":"https://api.github.com/repos/baSSiLL/json/git/trees{/sha}","statuses_url":"https://api.github.com/repos/baSSiLL/json/statuses/{sha}","languages_url":"https://api.github.com/repos/baSSiLL/json/languages","stargazers_url":"https://api.github.com/repos/baSSiLL/json/stargazers","contributors_url":"https://api.github.com/repos/baSSiLL/json/contributors","subscribers_url":"https://api.github.com/repos/baSSiLL/json/subscribers","subscription_url":"https://api.github.com/repos/baSSiLL/json/subscription","commits_url":"https://api.github.com/repos/baSSiLL/json/commits{/sha}","git_commits_url":"https://api.github.com/repos/baSSiLL/json/git/commits{/sha}","comments_url":"https://api.github.com/repos/baSSiLL/json/comments{/number}","issue_comment_url":"https://api.github.com/repos/baSSiLL/json/issues/comments{/number}","contents_url":"https://api.github.com/repos/baSSiLL/json/contents/{+path}","compare_url":"https://api.github.com/repos/baSSiLL/json/compare/{base}...{head}","merges_url":"https://api.github.com/repos/baSSiLL/json/merges","archive_url":"https://api.github.com/repos/baSSiLL/json/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/baSSiLL/json/downloads","issues_url":"https://api.github.com/repos/baSSiLL/json/issues{/number}","pulls_url":"https://api.github.com/repos/baSSiLL/json/pulls{/number}","milestones_url":"https://api.github.com/repos/baSSiLL/json/milestones{/number}","notifications_url":"https://api.github.com/repos/baSSiLL/json/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/baSSiLL/json/labels{/name}","releases_url":"https://api.github.com/repos/baSSiLL/json/releases{/id}","created_at":"2015-11-09T21:25:13Z","updated_at":"2015-11-09T21:25:14Z","pushed_at":"2015-11-11T13:21:22Z","git_url":"git://github.com/baSSiLL/json.git","ssh_url":"git@github.com:baSSiLL/json.git","clone_url":"https://github.com/baSSiLL/json.git","svn_url":"https://github.com/baSSiLL/json","homepage":"","size":1281,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"danielcrenna:master","ref":"master","sha":"9837724c89a846d8634a3f5a854c51df459e4784","user":{"login":"danielcrenna","id":129610,"avatar_url":"https://avatars.githubusercontent.com/u/129610?v=3","gravatar_id":"","url":"https://api.github.com/users/danielcrenna","html_url":"https://github.com/danielcrenna","followers_url":"https://api.github.com/users/danielcrenna/followers","following_url":"https://api.github.com/users/danielcrenna/following{/other_user}","gists_url":"https://api.github.com/users/danielcrenna/gists{/gist_id}","starred_url":"https://api.github.com/users/danielcrenna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielcrenna/subscriptions","organizations_url":"https://api.github.com/users/danielcrenna/orgs","repos_url":"https://api.github.com/users/danielcrenna/repos","events_url":"https://api.github.com/users/danielcrenna/events{/privacy}","received_events_url":"https://api.github.com/users/danielcrenna/received_events","type":"User","site_admin":false},"repo":{"id":1187723,"name":"json","full_name":"danielcrenna/json","owner":{"login":"danielcrenna","id":129610,"avatar_url":"https://avatars.githubusercontent.com/u/129610?v=3","gravatar_id":"","url":"https://api.github.com/users/danielcrenna","html_url":"https://github.com/danielcrenna","followers_url":"https://api.github.com/users/danielcrenna/followers","following_url":"https://api.github.com/users/danielcrenna/following{/other_user}","gists_url":"https://api.github.com/users/danielcrenna/gists{/gist_id}","starred_url":"https://api.github.com/users/danielcrenna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielcrenna/subscriptions","organizations_url":"https://api.github.com/users/danielcrenna/orgs","repos_url":"https://api.github.com/users/danielcrenna/repos","events_url":"https://api.github.com/users/danielcrenna/events{/privacy}","received_events_url":"https://api.github.com/users/danielcrenna/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danielcrenna/json","description":"A public-domain JSON parser written in C#. Supports dynamic deserialization in .NET 4.0, and runs on every .NET platform. Open specs and standards should be free.","fork":false,"url":"https://api.github.com/repos/danielcrenna/json","forks_url":"https://api.github.com/repos/danielcrenna/json/forks","keys_url":"https://api.github.com/repos/danielcrenna/json/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danielcrenna/json/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danielcrenna/json/teams","hooks_url":"https://api.github.com/repos/danielcrenna/json/hooks","issue_events_url":"https://api.github.com/repos/danielcrenna/json/issues/events{/number}","events_url":"https://api.github.com/repos/danielcrenna/json/events","assignees_url":"https://api.github.com/repos/danielcrenna/json/assignees{/user}","branches_url":"https://api.github.com/repos/danielcrenna/json/branches{/branch}","tags_url":"https://api.github.com/repos/danielcrenna/json/tags","blobs_url":"https://api.github.com/repos/danielcrenna/json/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danielcrenna/json/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danielcrenna/json/git/refs{/sha}","trees_url":"https://api.github.com/repos/danielcrenna/json/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danielcrenna/json/statuses/{sha}","languages_url":"https://api.github.com/repos/danielcrenna/json/languages","stargazers_url":"https://api.github.com/repos/danielcrenna/json/stargazers","contributors_url":"https://api.github.com/repos/danielcrenna/json/contributors","subscribers_url":"https://api.github.com/repos/danielcrenna/json/subscribers","subscription_url":"https://api.github.com/repos/danielcrenna/json/subscription","commits_url":"https://api.github.com/repos/danielcrenna/json/commits{/sha}","git_commits_url":"https://api.github.com/repos/danielcrenna/json/git/commits{/sha}","comments_url":"https://api.github.com/repos/danielcrenna/json/comments{/number}","issue_comment_url":"https://api.github.com/repos/danielcrenna/json/issues/comments{/number}","contents_url":"https://api.github.com/repos/danielcrenna/json/contents/{+path}","compare_url":"https://api.github.com/repos/danielcrenna/json/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danielcrenna/json/merges","archive_url":"https://api.github.com/repos/danielcrenna/json/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danielcrenna/json/downloads","issues_url":"https://api.github.com/repos/danielcrenna/json/issues{/number}","pulls_url":"https://api.github.com/repos/danielcrenna/json/pulls{/number}","milestones_url":"https://api.github.com/repos/danielcrenna/json/milestones{/number}","notifications_url":"https://api.github.com/repos/danielcrenna/json/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danielcrenna/json/labels{/name}","releases_url":"https://api.github.com/repos/danielcrenna/json/releases{/id}","created_at":"2010-12-21T17:14:25Z","updated_at":"2015-11-11T13:02:29Z","pushed_at":"2015-11-11T13:39:29Z","git_url":"git://github.com/danielcrenna/json.git","ssh_url":"git@github.com:danielcrenna/json.git","clone_url":"https://github.com/danielcrenna/json.git","svn_url":"https://github.com/danielcrenna/json","homepage":"","size":1333,"stargazers_count":36,"watchers_count":36,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":2,"forks":16,"open_issues":2,"watchers":36,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/danielcrenna/json/pulls/9"},"html":{"href":"https://github.com/danielcrenna/json/pull/9"},"issue":{"href":"https://api.github.com/repos/danielcrenna/json/issues/9"},"comments":{"href":"https://api.github.com/repos/danielcrenna/json/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/danielcrenna/json/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/danielcrenna/json/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/danielcrenna/json/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/danielcrenna/json/statuses/f7f080ac593ec4fe9048b8c54528daee0cafd747"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":110,"deletions":11,"changed_files":3}}