{"action":"opened","issue":{"url":"https://api.github.com/repos/gcanti/io-ts/issues/32","repository_url":"https://api.github.com/repos/gcanti/io-ts","labels_url":"https://api.github.com/repos/gcanti/io-ts/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/gcanti/io-ts/issues/32/comments","events_url":"https://api.github.com/repos/gcanti/io-ts/issues/32/events","html_url":"https://github.com/gcanti/io-ts/issues/32","id":214345367,"number":32,"title":"add a JSONFromString type","user":{"login":"gcanti","id":878912,"avatar_url":"https://avatars2.githubusercontent.com/u/878912?v=3","gravatar_id":"","url":"https://api.github.com/users/gcanti","html_url":"https://github.com/gcanti","followers_url":"https://api.github.com/users/gcanti/followers","following_url":"https://api.github.com/users/gcanti/following{/other_user}","gists_url":"https://api.github.com/users/gcanti/gists{/gist_id}","starred_url":"https://api.github.com/users/gcanti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcanti/subscriptions","organizations_url":"https://api.github.com/users/gcanti/orgs","repos_url":"https://api.github.com/users/gcanti/repos","events_url":"https://api.github.com/users/gcanti/events{/privacy}","received_events_url":"https://api.github.com/users/gcanti/received_events","type":"User","site_admin":false},"labels":[{"id":527680475,"url":"https://api.github.com/repos/gcanti/io-ts/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-03-15T10:27:01Z","updated_at":"2017-03-15T10:27:01Z","closed_at":null,"body":"Something along the lines of\r\n\r\n```ts\r\ntype JSONT = null | string | number | ...\r\n\r\nconst JSONFromString = new t.Type<JSONT>(\r\n  `JSON`,\r\n  (v, c) => t.string.validate(v, c).chain(s => {\r\n    try {\r\n      return t.success(JSON.parse(v))\r\n    } catch (e) {\r\n      return t.failure(v, c)\r\n    }\r\n  })\r\n)\r\n\r\n```\r\n\r\nReturns a JSON from a string"}}
{"actor":{"display_login":"gcanti"}}