JsonUtils icon indicating copy to clipboard operation
JsonUtils copied to clipboard

filter out key words

Open TerribleDev opened this issue 8 years ago • 3 comments

I have noticed when place json in that contains a keyword as a property, it will end up being called that in the c# code which will not compile.

For example


{
  "private": true
}

result:


public class PullRequestHook
    {
        [JsonProperty("private")]
        public bool private { get; set; }
    }

This won't compile since private is a keyword.

keywords such as ref, head, base, async,private, protected, etc should switch cases, or rename the properties in some manor so it will compile.

TerribleDev avatar Aug 10 '16 11:08 TerribleDev

The same is true for types like "Date" and others.

PeterCodar avatar Nov 20 '16 14:11 PeterCodar

Understood. I feel like that is something that should be called out to the developer so that they are aware the mapping wont be 1:1.

bladefist avatar Apr 17 '17 17:04 bladefist

@bladefist that's fair, like a warning box....

TerribleDev avatar Apr 17 '17 18:04 TerribleDev