The DataContractJsonSerializer creates JSON for F# record types that includes the \'@\' character after each property name. Does anyone know if it is possible to get JSON th
Although Daniel's solution will work correctly, it is rather tedious to have to add attributes to every property in the record. It turns out that Json.NET produces more readable JSON out of the box. For my application I do not need to use the DataContractSerializer specifically, so JSON.net it is!
It's using the name of the compiler generated backing fields. You can use DataMemberAttribute
to provide your own names.
[<DataContract>]
type Update = {
[<field: DataMember(Name="name")>]
name: string;
[<field: DataMember(Name="latitude")>]
latitude: decimal;
[<field: DataMember(Name="longitude")>]
longitude: decimal;
[<field: DataMember(Name="heart_rate")>]
heart_rate: int}