【问题标题】:json data inside a list [duplicate]列表中的json数据[重复]
【发布时间】:2016-03-03 12:14:40
【问题描述】:

我有以下代码,我需要在 List 中使用它。 有人可以帮我吗?

    protected void Page_Load(object sender, EventArgs e)
    {

        string url = "http://localhost:52148/api/federateds";

        using (var w = new WebClient())
        {
            var json_data = string.Empty;
            try
            {
                json_data = w.DownloadString(url);
            }
            catch (Exception) { }
        }

        List<federateds> federados = new ????;

    }

【问题讨论】:

标签: c# json jquery-jtable


【解决方案1】:

您应该尝试 JSON 框架,例如 Json.NET

有了它,你的代码看起来像

List<federateds> federados = JsonConvert.DeserializeObject<List<federateds>>(json_data);

【讨论】:

    猜你喜欢
    • 2019-04-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-05
    • 2019-07-23
    • 1970-01-01
    • 2016-09-10
    • 2018-12-20
    • 2016-11-26
    相关资源
    最近更新 更多