facebook-csharp-sdk / simple-json

JSON library for .NET 2.0+/SL4+/WP7/WindowsStore with optional support for dynamic and DataContract
MIT License
380 stars 143 forks source link

Deserialize to an f# record #30

Open albertjan opened 11 years ago

albertjan commented 11 years ago
type Test = {
    test: string
}

[<EntryPoint>]
let main argv = 
    let test = ConsoleApplication5.SimpleJson.DeserializeObject<Test>("{ \"test\": \"bier\" }");
    printfn "%s" test.test
    0 // return an integer exit code

A record does not have a constructor so it throws an exception.

But it can be made with FSharpValue.MakeRecord()

prabirshrestha commented 11 years ago

PR would be awesome for this.