{"action":"created","issue":{"url":"https://api.github.com/repos/intellifactory/websharper/issues/324","labels_url":"https://api.github.com/repos/intellifactory/websharper/issues/324/labels{/name}","comments_url":"https://api.github.com/repos/intellifactory/websharper/issues/324/comments","events_url":"https://api.github.com/repos/intellifactory/websharper/issues/324/events","html_url":"https://github.com/intellifactory/websharper/issues/324","id":55205776,"number":324,"title":"Add an attribute for fields to represent option<'T> as the presence/absence of the field","user":{"login":"Tarmil","id":921395,"avatar_url":"https://avatars.githubusercontent.com/u/921395?v=3","gravatar_id":"","url":"https://api.github.com/users/Tarmil","html_url":"https://github.com/Tarmil","followers_url":"https://api.github.com/users/Tarmil/followers","following_url":"https://api.github.com/users/Tarmil/following{/other_user}","gists_url":"https://api.github.com/users/Tarmil/gists{/gist_id}","starred_url":"https://api.github.com/users/Tarmil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tarmil/subscriptions","organizations_url":"https://api.github.com/users/Tarmil/orgs","repos_url":"https://api.github.com/users/Tarmil/repos","events_url":"https://api.github.com/users/Tarmil/events{/privacy}","received_events_url":"https://api.github.com/users/Tarmil/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/intellifactory/websharper/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/intellifactory/websharper/labels/proposal","name":"proposal","color":"ededed"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-22T20:39:46Z","updated_at":"2015-02-09T19:21:29Z","closed_at":"2015-02-09T19:21:29Z","body":"The idea is based on [this SO question](https://stackoverflow.com/questions/28078655/how-do-i-parse-json-objects-properties-from-external-request-into-options-in-we), and also the way some tools like FSharp.Data manage optional fields. For example:\r\n\r\n```fsharp\r\ntype Test =\r\n  { field1 : string\r\n    [<OptionAsOwnProperty>] field2 : string option }\r\n\r\nlet x1 = { field1 = \"yes\"; field2 = Some \"indeed\" }\r\n// x1 represented in js as: { field1: 'yes', field2: 'indeed' }\r\nlet x2 = { field1 = \"no\"; field2 = None }\r\n// x2 represented in js as: { field1: 'no' }\r\n```\r\n\r\nThis would be particularly useful for talking to web APIs using JSON.\r\n\r\nAlso, applying the attribute to a type would apply it to all of its fields of type `option<'T>`."},"comment":{"url":"https://api.github.com/repos/intellifactory/websharper/issues/comments/73571717","html_url":"https://github.com/intellifactory/websharper/issues/324#issuecomment-73571717","issue_url":"https://api.github.com/repos/intellifactory/websharper/issues/324","id":73571717,"user":{"login":"Tarmil","id":921395,"avatar_url":"https://avatars.githubusercontent.com/u/921395?v=3","gravatar_id":"","url":"https://api.github.com/users/Tarmil","html_url":"https://github.com/Tarmil","followers_url":"https://api.github.com/users/Tarmil/followers","following_url":"https://api.github.com/users/Tarmil/following{/other_user}","gists_url":"https://api.github.com/users/Tarmil/gists{/gist_id}","starred_url":"https://api.github.com/users/Tarmil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tarmil/subscriptions","organizations_url":"https://api.github.com/users/Tarmil/orgs","repos_url":"https://api.github.com/users/Tarmil/repos","events_url":"https://api.github.com/users/Tarmil/events{/privacy}","received_events_url":"https://api.github.com/users/Tarmil/received_events","type":"User","site_admin":false},"created_at":"2015-02-09T19:21:29Z","updated_at":"2015-02-09T19:21:29Z","body":"This was added (as `OptionalField`) in 59ea6e1bce4a4029bfce7eaca666f59a8e58257d."}}