I have a Json model that looks like this
private class SearchMetadataJson { public string entertain { get; set; } public string master { get; set; } public string memail { get; set; } public string key { get; set; } public (int, string)[] mood { get; set; } public int? soundnumber { get; set; } public int? ftv { get; set; } public int? com { get; set; } public (int, string)[] sims { get; set; } public (int, string)[] keysecond { get; set; } public string popt { get; set; } public (string, string) syncs { get; set; } }
And I try to de-serialize the object like this
var CommentObj = JsonSerializer.Deserialize<SearchMetadataJson>(CommentAsString);
The data that I'm trying to de-serialize (aka "CommentAsString") looks like this
"{\"entertain\":\"PEG\",\"master\":\"Phos Ent Group\",\"memail\":\"example@example.com\",\"key\":\"Db\",\"mood\":{\"1\":\"TypeA\",\"4\":\"TypeB\",\"5\":\"TypeC\"},\"soundnumber\":\"5\",\"ftv\":\"4\",\"com\":\"3\",\"sims\":{\"1\":\"Band1\",\"2\":\"Band2\"},\"keysecond\":{\"1\":\"KeyWord1\",\"2\":\"KeyWord2\",\"3\":\"KeyWord3\"},\"syncs\":{\"Other pubber\":\"example2@example.com\"}}"
Does anyone see what the problem is?
https://stackoverflow.com/questions/65854979/c-sharp-mvc-cant-deserialize-a-tuple January 23, 2021 at 09:53AM
没有评论:
发表评论