我有以下型号
public class UserSettings
{
public bool SendEmailAlertsForNewArticlesOrReports { get; set; }
public bool ShowNotificationsInCubeBrowserForArticlesAndReports { get; set; }
}
我像这样序列化
string sUserSettings = JsonConvert.SerializeObject(userSettings);
它将其存储在后端
"{\"SendEmailAlertsForNewArticlesOrReports\":false,\"ShowNotificationsInCubeBrowserForArticlesAndReports\":true}"
当我试图像这样反序列化
时UserSettings userSettings = JsonConvert.DeserializeObject<UserSettings>(result);
结果的值是
"{\"SendEmailAlertsForNewArticlesOrReports\":false,\"ShowNotificationsInCubeBrowserForArticlesAndReports\":true}"
我收到此错误
无法从System.String转换或转换为RystadEnergy.Web.Models.Rystad.UserSettings
任何人都知道我错过了什么?