0
public class Restaurants1
        {
            public string id { get; set; }
            public string name { get; set; }
            public string address { get; set; }
            public string contact { get; set; }
            public string links { get; set; }
            public string about { get; set; }
            public string info { get; set; }
            public string image { get; set; }
            public string lat { get; set; }
            public string lng { get; set; }
            public string currency { get; set; }
            public string minprice { get; set; }
            public string maxprice { get; set; }
            public string facility { get; set; }
            public string keywords { get; set; }
            public string status { get; set; }
            public string review_count { get; set; }
            public string distance { get; set; }
            public string menu_image { get; set; }
            public string menu_resizead { get; set; }
        }
    public class Restaurants2
    {
        public string id { get; set; }
        public string name { get; set; }
        public string address { get; set; }
        public string contact { get; set; }
        public string links { get; set; }
        public string about { get; set; }
        public string info { get; set; }
        public string image { get; set; }
        public string lat { get; set; }
        public string lng { get; set; }
        public string currency { get; set; }
        public string minprice { get; set; }
        public string maxprice { get; set; }
        public string facility { get; set; }
        public string keywords { get; set; }
        public string status { get; set; }
        public string review_count { get; set; }
        public string distance { get; set; }
        public string menu_image { get; set; }
        public string menu_resizead { get; set; }
    }

    public class Result
    {
        public List<Restaurants1> restaurants1 { get; set; }
        public List<Restaurants2> restaurants2 { get; set; }
        public bool no_featured { get; set; }
    }

    public class RootObject
    {
        public string status { get; set; }
        public Result result { get; set; }
    }

       var url = e.UserState as Uri;
       RootObject root = JsonConvert.DeserializeObject<RootObject>(e.Result); 
                  MessageBox.Show("success");

RootObject root = JsonConvert.DeserializeObject<RootObject>(e.Result) is Error
like this :

错误 1 ​​'Newtonsoft.Json.JsonConvert.DeserializeObject(string)' 的最佳重载方法匹配有一些无效参数 E:\parsingjson\parsingjson\MainPage.xaml.cs 103 30 parsingjson

为什么?
以及如何解决?

4

1 回答 1

0

发布包含至少一条记录的 json 片段。你确定 e.Result 是字符串类型吗?如果它是一个流,那么您需要使用 StreamReader 将流读入字符串,以便 Json Deserializer 工作。

于 2013-10-14T08:33:34.213 回答