Ich konvertiere meine NewtonSoft-Implementierung in eine neue JSON-Bibliothek in .net Core 3.0. Ich habe den folgenden Code
public static bool IsValidJson(string json)
{
try
{
JObject.Parse(json);
return true;
}
catch (Exception ex)
{
Logger.ErrorFormat("Invalid Json Received {0}", json);
Logger.Fatal(ex.Message);
return false;
}
}
Ich kann kein Äquivalent für finden JObject.Parse(json);
Was auch das Attribut sein JsonProperty
Äquivalent
public class ResponseJson
{
[JsonProperty(PropertyName = "status")]
public bool Status { get; set; }
[JsonProperty(PropertyName = "message")]
public string Message { get; set; }
[JsonProperty(PropertyName = "Log_id")]
public string LogId { get; set; }
[JsonProperty(PropertyName = "Log_status")]
public string LogStatus { get; set; }
public string FailureReason { get; set; }
}
Eine weitere Sache, nach der ich suchen werde Formating.None
.