-
-
Save jovaneyck/40ed150675e112fd175012a4b13f8576 to your computer and use it in GitHub Desktop.
Generate types from sample JSON.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r @"..\packages\Fsharp.Data\lib\net40\Fsharp.Data.dll" | |
open FSharp.Data | |
[<Literal>] | |
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