Json列在C#中

时间:2017-11-22 14:39:58

标签: c# json list parsing

我有一个json文件,这是它的格式:

{"resultset": {"row": [
       {"field": [1001001, 1, 1, 1, "In the beginning God{After \\\"God,\\\" the Hebrew has the two letters \\\"Aleph Tav\\\" (the first and last letters of the Hebrew alphabet) as a grammatical marker.} created the heavens and the earth."]},  
       {"field": [1001002, 1, 1, 2, "Now the earth was formless and empty. Darkness was on the surface of the deep. God's Spirit was hovering over the surface of the waters."]} 
]}}

如何将其存储在列表中?我想将所有值存储在列表中的"字段" 中。 注意:我收集了大量数据。

1 个答案:

答案 0 :(得分:1)

创建一个这样的对象:

public class Field
{
    /*Your properties here*/
}

public class Row
{
    public List<Field> field { get; set; }
}

public class Resultset
{
    public List<Row> row { get; set; }
}

public class RootObject
{
    public Resultset resultset { get; set; }
}

将JSON反序列化为根对象,以便浏览到字段列表。