Skip to content

Is there a way to hide properties with null values for JsonProvider? #1245

@nikoudel

Description

@nikoudel

This piece of code:

open FSharp.Data

type ColorProvider = JsonProvider<"""
[
  {
    "color": "Red",
    "code": 15
  },
  {
    "color": "Green"
  }
]
""", SampleIsList=true>

let value = ColorProvider.Root(color = "Blue", code = None)

printf "%A" value

Produces this JSON:

{
  "color": "Blue",
  "code": null
}

Can I somehow configure the provider to skip the code property in this case?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions