{"action":"created","issue":{"url":"https://api.github.com/repos/fsprojects/Fable/issues/332","repository_url":"https://api.github.com/repos/fsprojects/Fable","labels_url":"https://api.github.com/repos/fsprojects/Fable/issues/332/labels{/name}","comments_url":"https://api.github.com/repos/fsprojects/Fable/issues/332/comments","events_url":"https://api.github.com/repos/fsprojects/Fable/issues/332/events","html_url":"https://github.com/fsprojects/Fable/issues/332","id":169898797,"number":332,"title":"Add type validation when deserialising json","user":{"login":"MangelMaxime","id":4760796,"avatar_url":"https://avatars.githubusercontent.com/u/4760796?v=3","gravatar_id":"","url":"https://api.github.com/users/MangelMaxime","html_url":"https://github.com/MangelMaxime","followers_url":"https://api.github.com/users/MangelMaxime/followers","following_url":"https://api.github.com/users/MangelMaxime/following{/other_user}","gists_url":"https://api.github.com/users/MangelMaxime/gists{/gist_id}","starred_url":"https://api.github.com/users/MangelMaxime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MangelMaxime/subscriptions","organizations_url":"https://api.github.com/users/MangelMaxime/orgs","repos_url":"https://api.github.com/users/MangelMaxime/repos","events_url":"https://api.github.com/users/MangelMaxime/events{/privacy}","received_events_url":"https://api.github.com/users/MangelMaxime/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/fsprojects/Fable/labels/feature","name":"feature","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-08T11:14:07Z","updated_at":"2016-08-11T12:52:24Z","closed_at":null,"body":"It's could be good to have type validation when deserialising the json file. \r\n\r\nLike so we could help the user track bug and garantee the data getted from the server."},"comment":{"url":"https://api.github.com/repos/fsprojects/Fable/issues/comments/239151832","html_url":"https://github.com/fsprojects/Fable/issues/332#issuecomment-239151832","issue_url":"https://api.github.com/repos/fsprojects/Fable/issues/332","id":239151832,"user":{"login":"theprash","id":1362490,"avatar_url":"https://avatars.githubusercontent.com/u/1362490?v=3","gravatar_id":"","url":"https://api.github.com/users/theprash","html_url":"https://github.com/theprash","followers_url":"https://api.github.com/users/theprash/followers","following_url":"https://api.github.com/users/theprash/following{/other_user}","gists_url":"https://api.github.com/users/theprash/gists{/gist_id}","starred_url":"https://api.github.com/users/theprash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theprash/subscriptions","organizations_url":"https://api.github.com/users/theprash/orgs","repos_url":"https://api.github.com/users/theprash/repos","events_url":"https://api.github.com/users/theprash/events{/privacy}","received_events_url":"https://api.github.com/users/theprash/received_events","type":"User","site_admin":false},"created_at":"2016-08-11T12:52:24Z","updated_at":"2016-08-11T12:52:24Z","body":"To clarify, the target type in the type parameter from `JsInterop.ofJson<T>` should be passed into the TypeScript [`ofJson` function](https://github.com/fsprojects/Fable/blob/87891e955454e4eb3e282674d6a45a265cd1473d/src/fable/Fable.Core/npm/fable-core.ts#L255) so that it can it can enforce that the JSON matches the target type.\r\n\r\nIt could throw an exception if the types do not match, but maybe it would be better return an Option or Result type to get more compile time safety. Bear in mind that F# 4.1 will have a [Result type](https://github.com/fsharp/fsharp/blob/1722f2ecd3fd6e4660cd27d52ac9b180e5c51851/src/fsharp/FSharp.Core/prim-types.fsi#L1775)."}}
{"actor":{"display_login":"theprash"}}