JSON TypeProvider and null values in arrays

I do not think there is a way to tell JSON provider not to do this, but I agree it would sometimes be useful (in case you wanted to try contributing to the project!)

In the meantime, if you want to iterate over all the values in the array, including nulls, you can use the low-level underlying JsonValue directly. It is less elegant, but lets you do what you need for this one part of JSON processing:

[<Literal>]
let sample = """{ "foo": [ 10, null ] }"""
type InputTypes = JsonProvider<sample>

InputTypes.Parse(sample).JsonValue.["foo"].AsArray()
|> Array.map (function 
    | JsonValue.Number n -> Some n 
    | _ -> None)