任何人都知道如何访问此返回的json中的各个项目? 例如:" id"," name"," tvrageid"
此代码适用于此文件: 部分代码:
Private Sub cmdReadJSON_Click()
Dim p As Object
cd.ShowOpen
If cd.FileName <> "" Then
Set p = JSON.parse(ReadTextFile(cd.FileName))
If Not (p Is Nothing) Then
If JSON.GetParserErrors <> "" Then
MsgBox JSON.GetParserErrors, vbInformation, "Parsing Error(s)
occured"
Else
MsgBox "Base item count: " & p.Count
MsgBox "JSON toString: " & Left(JSON.toString(p), 2000)
MsgBox "Id: " & p.Item("id") & " Name: " & p.Item("name")
MsgBox "TVRage: " & p.Item("externals")("tvrage")
End If
Else
MsgBox "An error occurred parsing " & cd.FileName
End If
End If
End Sub
以上代码适用于此 XXXX://api.tvmaze.com/search/shows Q =女孩
{"id":82,"url":"xxxx://www.tvmaze.com/shows/82/game-of-thrones","name":"Game of Thrones","type":"Scripted","language":"English","genres":["Drama","Adventure","Fantasy"],"status":"Running","runtime":60,"premiered":"2011-04-17","rating":{"average":9.5},"weight":50,"network":{"id":8,"name":"HBO","country":{"name":"United States","code":"US","timezone":"America/New_York"}},"webChannel":null,"externals":{"tvrage":24493,"thetvdb":121361},"image":{"medium":"xxxx://tvmazecdn.com/uploads/images/medium_portrait/0/581.jpg","original":"xxxx://tvmazecdn.com/uploads/images/original_untouched/0/581.jpg"},"summary":"<p>Based on the bestselling book series A Song of Ice and Fire by George R.R. Martin, this sprawling new HBO drama is set in a world where summers span decades and winters can last a lifetime. From the scheming south and the savage eastern lands, to the frozen north and ancient Wall that protects the realm from the mysterious darkness beyond, the powerful families of the Seven Kingdoms are locked in a battle for the Iron Throne. This is a story of duplicity and treachery, nobility and honor, conquest and triumph. In the Game of Thrones, you either win or you die.</p>","_links":{"self":{"href":"xxxx://api.tvmaze.com/shows/82"},"previousepisode":{"href":"xxxx://api.tvmaze.com/episodes/162186"}}}
但不适用于此文件: 示例:xxxx://api.tvmaze.com/search/shows?q = hawaii five-0
返回包含以下内容的json文件:
[{"score":7.8952017,"show":{"id":24,"url":"xxxx://www.tvmaze.com/shows/24/hawaii-five-0","name":"Hawaii Five-0","type":"Scripted","language":"English","genres":["Action","Adventure","Crime"],"status":"Running","runtime":60,"premiered":"2010-09-20","rating":{"average":8.4},"weight":22,"network":{"id":2,"name":"CBS","country":{"name":"United States","code":"US","timezone":"America/New_York"}},"webChannel":null,"externals":{"tvrage":24840,"thetvdb":164541},"image":{"medium":"xxxx://tvmazecdn.com/uploads/images/medium_portrait/0/294.jpg","original":"xxxx://tvmazecdn.com/uploads/images/original_untouched/0/294.jpg"},"summary":"<p>HAWAII FIVE-0 is a contemporary take on the classic series about a new elite federalized task force whose mission is to wipe out the crime that washes up on the Islands' sun-drenched beaches. Detective Steve McGarrett, a decorated Naval officer-turned-cop, returns to Oahu to investigate his father's murder and stays after Hawaii's Governor persuades him to head up the new team: his rules, her backing, no red tape and full blanket authority to hunt down the biggest \"game\" in town. Joining McGarrett is Detective Danny \"Danno\" Williams, a newly relocated ex-New Jersey cop - a working man in paradise who prefers skyscrapers to the coastline - but who's committed to keeping the Islands safe for his 8-year-old daughter; and Chin Ho Kelly, an ex-Honolulu Police Detective, and former protégé of McGarrett's father, wrongly accused of corruption and relegated to a federal security patrol. Chin's cousin, Kono Kalakaua, is a beautiful and fearless native, fresh out of the academy and eager to establish herself among the department's elite. McGarrett, repairing his relationship with his estranged sister Mary Ann, vows to bring closure to their father's case, while the state's brash new FIVE-0 unit, who may spar and jest among themselves, is determined to eliminate the seedy elements from the 50th state.</p>","updated":1442079542,"_links":{"self":{"href":"xxxx://api.tvmaze.com/shows/24"},"previousepisode":{"href":"xxxx://api.tvmaze.com/episodes/152994"},"nextepisode":{"href":"xxxx://api.tvmaze.com/episodes/167425"}}}}]
非常感谢任何帮助或指导。
答案 0 :(得分:0)
我明白了。它不是自由人。这是我的代码。引用我需要使用的id
p.item(1).item("show").item("id")
这将返回24
。
这是VB6而不是VB.NET