-
Notifications
You must be signed in to change notification settings - Fork 25
Description
This is OK:
type Test = {
inside: {| zbc: obj option |}
}
"""
{ "inside": { "zbc": null } }
"""
|> Json.deserializeEx<Test> (JsonConfig.create(allowUntyped = true))
This results in an NRE:
type Test = {
inside: obj option
}
"""
{ "inside": { "zbc": null } }
"""
|> Json.deserializeEx<Test> (JsonConfig.create(allowUntyped = true))
Stack trace:
System.NullReferenceException: Object reference not set to an instance of an object.
at FSharp.Json.Core.deserializeNonOption@322(JsonConfig config, JsonPath path, Type t, JsonField jsonField, JsonValue jvalue)
at FSharp.Json.Core.mapping@1(JsonConfig config, JsonPath path, Type itemValueType, String field0, JsonValue field1)
at FSharp.Json.Core.deserializeMap@399(JsonConfig config, JsonPath path, Type t, JsonValue jvalue)
at FSharp.Json.Core.deserializeNonOption@322(JsonConfig config, JsonPath path, Type t, JsonField jsonField, JsonValue jvalue)
at FSharp.Json.Core.deserializeUnwrapOption@376(JsonConfig config, JsonPath path, Type t, JsonField jsonField, FSharpOption`1 jvalue)
at FSharp.Json.Core.deserializeRecord@463(JsonConfig config, JsonPath path, Type t, JsonValue jvalue)
at FSharp.Json.Json.deserializeEx[T](JsonConfig config, String json)
at <StartupCode$FSI_0055>.$FSI_0055.main@() in /home/rei/source/HAInterface/HAInterface/Script1.fsx:line 64
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Stopped due to error