Skip to content

Instantly share code, notes, and snippets.

Created Jun 18, 2017
What would you like to do?
Generate types from sample JSON.
#r @"..\packages\Fsharp.Data\lib\net40\Fsharp.Data.dll"
open FSharp.Data
let sample = @"{
""title"" : ""Management 4.2"",
""author"" : {
""firstName"" : ""Jurgen"",
""lastName"" : ""Appelo""
""ISBN"" : ""978-0321123479"",
""createdAt"" : ""2017-04-07T23:03:52.692+02:00"",
""updatedAt"" : ""2017-06-09T13:44:31.728+02:00""
type BookTypes = JsonProvider<sample, RootName="book">
let book = BookTypes.Book("title",BookTypes.Author("first name", "last name"),"isbn", System.DateTime.Now, System.DateTime.Now)
printfn "%A" book
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment