假设我有一个示例 Json 格式字符串为
string per1 = @"[{""Email"":""AAA"",""mj_campaign_id"":""22"",""mj_contact_id"":""PPP"",""customcampaign"":""AAA"",""blocked"":""22"",""hard_bounce"":""PPP"",""blocked"":""22"",""hard_bounce"":""PPP""},"
+ @"{""Email"":""BBB"",""mj_campaign_id"":""25"",""mj_contact_id"":""QQQ"",""customcampaign"":""AAA"",""blocked"":""22"",""hard_bounce"":""PPP"",""blocked"":""22""},"
+ @"{""Email"":""CCC"",""mj_campaign_id"":""38"",""mj_contact_id"":""RRR"",""customcampaign"":""AAA"",""blocked"":""22"",""hard_bounce"":""PPP""}]";
我正在尝试使用反序列化它
var result = JsonConvert.DeserializeObject(per1);
只要字符串的所有行都具有以下属性的值,它就可以正常工作 Email、mj_campaign_id、mj_contact_id、customcampaign、blocked、hard_bounce、error_related_to、error。但是当我在某些行中跳过一些 sttribute 值时,它会抛出一个错误说
无法将 Newtonsoft.Json.Linq.JValue 添加到 Newtonsoft.Json.Linq.JObject。
任何帮助,将不胜感激。谢谢