我想要一个打开 Json 文件并使用 VB.Net 循环使用 JSon.Net 的值的简单示例
这是简单的Json:
{
root: [
{
"__type": "BannerElement",
"Id": 1,
"Title": "Politics",
"Text": "Some Text",
"ImageFile": "/Religion-in-Politics--DM1.1.jpg",
"ReadMoreUrl": "http://google.com",
"SortOrder": 0,
"Disabled": false
},
{
"__type": "BannerElement",
"Id": 2,
"Title": "God",
"Text": "Some Text",
"ImageFile": "/Religion-in-Politics--DM1.1.jpg",
"ReadMoreUrl": "http://google.com",
"SortOrder": 1,
"Disabled": false
}
]
}
我似乎在互联网/谷歌上找不到任何例子......
这是我到目前为止所拥有的......
strJSonPath = Replace(Replace(String.Format("{0}/json/slides.js", ConfigurationManager.AppSettings("APPhysicalPath")), "\", "/"), "//", "/")
Dim strJson As String = File.ReadAllText(strJSonPath)
Dim jobj As JObject = JObject.Parse(strJson)
Dim arrJArray As JArray = jobj("root")