更新时间:2023-01-17 10:51:37
只需使用这样的:
词典<字符串,字符串> movieValues =
JsonConvert.DeserializeObject<&字典LT;字符串,字符串>>(responseFromImdbApi);
刚刚得到的值是这样的:
movieValues [标题]
movieValues [释放]
movieValues [流派]
I am querying data from http://www.imdbapi.com and would like to parse the result using Json.net library. Could someone please tell me how I can use this library to convert the query response into a Map<string, string>
.
With this code I'm able to get all keys, but how can query the values then?
JObject obj = JObject.Parse(response);
IList<string> props = obj.Properties().Select(p => p.Name).ToList();
Try JSON.NET
Just use this:
Dictionary<string, string> movieValues =
JsonConvert.DeserializeObject<Dictionary<string, string>>(responseFromImdbApi);
Just get the values like this:
movieValues["title"]
movieValues["released"]
movieValues["genre"]