F#: How to apply Json.NET [JsonConstructor] attribute to primary constructor?
问题 I'm trying to do something in F# like the JsonConstructorAttribute example in the Json.NET documentation: public class User { public string UserName { get; private set; } public bool Enabled { get; private set; } public User() { } [JsonConstructor] public User(string userName, bool enabled) { UserName = userName; Enabled = enabled; } } The analog in F# appears to be something like the following, but I'm getting an error on the placement of [<JsonConstructor>] : [<JsonConstructor>] // ERROR!