support F# data type for serialization and deserialization
This is specially for option type and discriminated unions. Currently it is not supported by Servicestack.Text. It would be great to have support for that.
For
type City = Abad | Pune
[<CLIMutableAttribute>]
type Person = {
FirstName:string
LastName: string option
City : City
}
let p1 = {FirstName = "Foo"; LastName = Some "Bar"; City = Pune}
let jss = new JsonStringSerializer()
let p1Str = jss.SerializeToString(p1)
It is serializing
"{"FirstName":"Foo","LastName":{"Value":"Bar"},"City":{"Tag":1,"IsAbad":false,"IsPune":true}}"
Where is should be
"{"FirstName":"Foo","LastName":"Bar","City":"Pune"}"
For reference https://github.com/Microsoft/fsharplu/wiki/fsharplu.json is library by MSR.
It would be great to have this feature so DTO can be written in F# types. Currently we have to translate to C# like object so it can be serialize properly.

-
Brent commented
Regarding option types, we can get half-way there by registering custom serializers. See: http://www.fssnip.net/ij
(Just remember to register the serializers before initializing your AppHost)
One problem is that generated DTO binding files will expose the property as a custom type called FSharpOption<T>. This might be okay for a F# client (although I haven't tested it), but it's inconvenient for other clients like C#. We've basically pushed the "semantic mismatch" from the server to the client.
A second problem is that even if ServiceStack.Text recognized supported Option<T> similar to the Nullable<T> type, what is supposed to happen when we have a non-option CLR reference type property on your DTO, like string? This could be null over the wire, and would somehow need to be validated to ensure it is not-null.
It's an interesting problem!