This is about how to use Nuget Package NewtonSoft.Json in C# (.Net, .Net Framework)
Download the package NewtonSoft.Json
string serial = JsonConvert.SerializeObject(obj, Formatting.Indented);
File.WriteAllText(filePath, serial);
T data = JsonConvert.DeserializeObject<T>(File.ReadAllText(filePath));
write [JsonIgnore]
on the declaration of the field.
[JsonIgnore]
public int mySecretField;
write [JsonConverter(typeof(StringEnumConverter))]
on the declaration of the enum field
(not declaration of the enum)
[JsonConverter(typeof(StringEnumConverter))]
public myEnum myEnumField = myEnum.HELLO;
foreach(var fileInfo in typeof(MyClass).GetFields().Where(field => !Attribute.IsDefine(field, typeof(JsonIgnoreAttribute))))
{...}