Is there any way to set the name of the serializable field? I'm trying to work with JIRA webhooks and I ran into an issue where their request package contains a field that is a protected keyword in Apex:
JSON
{
"toString": "A new summary.",
"to": null,
"fromString": "What is going on here?????",
"from": null,
"fieldtype": "jira",
"field": "summary"
}
Class
public class Item
{
public string toString { get; set; }
public string to { get; set; }
public string fromString { get; set; }
public string from { get; set; }
public string fieldtype { get; set; }
public string field { get; set; }
}
When I try to save this I get an error:
unexpected token: 'from'
C# has a annotation you can add to set the serializable name: [JsonProperty(PropertyName = "FooBar")]
Not sure if apex has anything similar.