I am trying to deserialize very simple json in F # with Newtonsoft.Json 5.0.4:
#if INTERACTIVE #r "C:/Users/OCatenacci/fshacks/CreateWeeklySWEEventsEmail/packages/Newtonsoft.Json.5.0.4/lib/net40/Newtonsoft.Json.dll" #endif open System open Newtonsoft.Json type meta() = class member val count = 0 with get, set end let testjson = """{ "meta": { "count": 15 } }""" let o = JsonConvert.DeserializeObject<meta>(testjson)
meta always gets 0 in the score. By the way, I initially defined the meta as:
type meta = { count: int }
And I switched to using the Automatic property because I thought Newtonsoft.Json might not be able to build the object correctly.
I would be surprised if my version of F # / Windows mattered in this case, but only for completeness: I try this with the F # 3.0 Repl (11.0.60315.1) and I run Win7 x64 (SP1).
source share