在括号内加载包含JSON的JSON文件

我正在尝试使用C#和JSON.Net在网站上加载JSON文件

但是,我在运行时遇到问题,因为所有JSON都在[]内。

这是JSON:

[{"embed_count":"16","name":"live_user_catreina","stream_count":"133","category":"gaming","format":"live","channel_count":272,"title":"SWTOR - Sith Marauder - L42 - Belsavis - The Fatman","featured":true,"site_count":"117","abuse_reported":false,"channel":{"image_url_large":"http://sofzh.miximages.com/c%23/404_preview-300x300.png","channel_url":"http://www.justin.tv/catreina","category_title":"Gaming","screen_cap_url_large":"http://sofzh.miximages.com/c%23/404_preview-320x240.png","mature":null,"subcategory":null,"category":"gaming","image_url_medium":"http://sofzh.miximages.com/c%23/404_preview-150x150.png","subcategory_title":null,"status":"SWTOR - Sith Marauder - L42 - Belsavis - The Fatman","screen_cap_url_medium":"http://sofzh.miximages.com/c%23/404_preview-150x113.png","image_url_small":"http://sofzh.miximages.com/c%23/404_preview-70x70.png","timezone":"US/Eastern","screen_cap_url_small":"http://sofzh.miximages.com/c%23/404_preview-70x53.png","id":5895485,"views_count":"6142420","embed_enabled":true,"embed_code":" \n","producer":true,"image_url_tiny":"http://sofzh.miximages.com/c%23/404_preview-50x50.png","image_url_huge":"http://sofzh.miximages.com/c%23/404_preview-600x600.png","language":"en","tags":"games gaming lord lotro mmo mmorpg of online pc rings rpg sc2 scii starcraft starcraft2 the vindictus warcraft wow","login":"catreina","screen_cap_url_huge":"http://sofzh.miximages.com/c%23/404_preview-630x473.png","title":"Gaming With Catreina"},"video_height":720,"language":"en","video_bitrate":1987.1328125,"id":"2309110144","meta_game":"Star Wars: The Old Republic","broadcaster":"fme","broadcast_part":4,"audio_codec":"uncompressed","up_time":"Mon Dec 26 00:06:03 2011","video_width":1280,"geo":"US","channel_view_count":6133751,"channel_subscription":false,"embed_enabled":true,"stream_type":"live","video_codec":"AVC"}] 

我尝试使用以下代码加载它:

 class Program { static void Main(string[] args) { WebClient webclient = new WebClient(); var data = webclient.DownloadString("http://api.justin.tv/api/stream/list.json?channel=catreina"); JObject jo = JObject.Parse(data); Console.WriteLine("Embed Count: " + jo["embed_count"]); Console.ReadLine(); } } 

但它显然给了我这个错误

未处理的exception:System.Exception:从JsonReader读取JObject时出错。 当前的JsonReader项不是对象:StartArray

如何使用[]加载JSON然后解析值?

当在JSON中使用[] ,这意味着一个数组

使用JArray而不是JObject

 WebClient webclient = new WebClient(); var data = webclient.DownloadString("http://api.justin.tv/api/stream/list.json?channel=catreina"); JArray ja = JArray.Parse(data); Console.WriteLine("Embed Count: " + ja[0]["embed_count"]); Console.ReadLine();