Reputation: 4862
C# do not allows property names with special characters like space etc. Need to have a way to define json objects like this. Any idea ?
{
".Class1 #Id1" : "Value1"
".Class1 #Id2" : "Value2"
}
Upvotes: 2
Views: 367
Reputation: 4520
Try using the JsonProperty attribute:
public class MyClass
{
[JsonProperty(".Class1 #Id1")]
public string id1 { get; set; }
[JsonProperty(".Class1 #Id2")]
public string id2 { get; set; }
}
Upvotes: 5