我試圖從反序列化在ASP.NET中openlibrary.org JSON字符串(4.5 )使用JSON.NET的Web應用程序。
我的目標是能夠從單個.Net對象讀取下面的5個屬性。
的example JSON 我是:
{"ISBN:0201558025":
{
"bib_key": "ISBN:0201558025",
"preview": "noview",
"thumbnail_url": "http://covers.openlibrary.org/b/id/135182-S.jpg",
"preview_url": "http://openlibrary.org/books/OL1429049M/Concrete_mathematics",
"info_url": "http://openlibrary.org/books/OL1429049M/Concrete_mathematics"
}
}
我可以得到它沒有第一線工作得很好,但我有點失去試圖找出我應該怎麼構建我的班。
我是JSON的新手,幾年之後還沒有在C#/ VB.NET中玩過,所以很迷茫。
更新
我有以下代碼:
Dim url = "http://openlibrary.org/api/books?bibkeys=ISBN:0201558025&format=json"
Dim webClient = New System.Net.WebClient
Dim json = webClient.DownloadString(url)
Dim book As Book = JsonConvert.DeserializeObject(Of Book)(json)
和類圖書:
Public Class Book
Public bib_key As String
Public preview As String
Public preview_url As String
Public info_url As String
End Class
然而,書變成了空。
謝謝,我曾試過,但不知道有關的國際標準書號位。我現在面臨的問題是,我的圖書對象沒有收到詳細信息,這導致我認爲我可能錯過了一堂課。 – ataru