2

For example, why is it needed on below code, how can it further be being used?

public class FileAttachment
{
    [JsonProperty("fileName")]
    public string FileName{ get; set; }
}
A.Blanc
  • 403
  • 1
  • 6
  • 15

1 Answers1

4

Per the documentation: this is the json key that will be used when serializing/deserializing this object to/from a json string.

So, if the value of FileName is file.txt, the serialized result would be

{
    "fileName": "file.txt"
}
Jerodev
  • 32,252
  • 11
  • 87
  • 108