Feature Request / Adding Json Property names to generated C# code.

If you generate C# classes from Json using either json2csharp or Visual Studio itself (via Paste Special/Paste JSON as Classes), the generated code uses the Json field names.  It would be nice to have the ability to change the C# properties (class names, etc) to follow standard naming conventions and then have a JsonProperty attributed added to each item.


For example, this is a C# class generated automatically from Json:

public class OptionalCoverage
{
public string name { get; set; }
public int code { get; set; }
}

It would be nice to have the ability for Resharper to alter the code as follows:

public class OptionalCoverage
{
[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("code")]
public int Code { get; set; }
}

Thanks,
Todd

 

0
1 comment
Official comment

Hello Todd!

 

Thank you for contacting us.

Here's similar feature request reported - https://youtrack.jetbrains.com/issue/RSRP-460148

You are welcome to comment or vote for it.

Thank you.

Please sign in to leave a comment.