Jsonオブジェクトを順番に動的リストに逆シリアル化しようとしているので、次のようになります。
ジョンソン:
string json = "{'elements':[
{'EntityA':[
{'name ':'Jhon'}
],
'EntityB':[
{'title' : 'car'}
],
'EntityB':[
{'title':'aaa'}
],
'EntityA':[
{'name' : 'Alice'}
]]}";
.NET クラスの基本クラス:
public interface EntitysInterface{}
public class EntityA: EntitysInterface
{
public string name { get; set; }
}
public class EntityB: EntitysInterface
{
public string title { get; set; }
}
public class Entitys
{
public List<EntitysInterface> elements { get; set; } //EntityA, EntityB,...
public Entitys()
{
}
}
私の DeserializeObject 難しい:
Entitys listFinaly = JsonConvert.DeserializeObject<Entitys>(json);
例外「タイプはインターフェースまたは抽象クラスであり、インスタンス化できません。:(」