fsprojects / FSharp.Data

F# Data: Library for Data Access
https://fsprojects.github.io/FSharp.Data
Other
814 stars 287 forks source link

XmlProvider has XElement on every node but this means I can't serialize the type #1317

Open Bananas-Are-Yellow opened 4 years ago

Bananas-Are-Yellow commented 4 years ago

The type that XmlProvider generates has an XElement property on every node, but this means I can't serialize it.

I am using Bolero and want to create a remote service where some of the function arguments are types generated by XmlProvider. Bolero automatically generates serialization code for RPC, but it complains saying:

No JSON encoding for System.Xml.Linq.XElement

Is there a workaround?

OscarAblinger commented 3 years ago

You cannot really map 1:1 in between XML and JSON since XML has more concepts (e.g. attributes). That said, the documentation includes a page on that: https://fsprojects.github.io/FSharp.Data/tutorials/JsonToXml.html