How to get an item value of json using C#?

Posted by user3487837 on Stack Overflow See other posts from Stack Overflow or by user3487837
Published on 2014-08-22T04:10:16Z Indexed on 2014/08/22 4:20 UTC
Read the original article Hit count: 92

Filed under:
|

How to get an item value of json using C#?

json:

[{
    ID: '6512',
    fd: [{
        titie: 'Graph-01',
        type: 'graph',
        views: {
            graph: {
                show: true,
                state: {
                    group: 'DivisionName',
                    series: ['FieldWeight', 'FactoryWeight', 'Variance'],
                    graphType: 'lines-and-points'
                }
            }
        }
    }, {
        titie: 'Graph-02',
        type: 'Graph',
        views: {
            graph: {
                show: true,
                state: {
                    group: 'DivisionName',
                    series: ['FieldWeight', 'FactoryWeight', 'Variance'],
                    graphType: 'lines-and-points'
                }
            }
        }
    }]
}, {
    ID: '6506',
    fd: [{
        titie: 'Map-01',
        type: 'map',
        views: {
            map: {
                show: true,
                state: {
                    kpiField: 'P_BudgetAmount',
                    kpiSlabs: [{
                        id: 'P_BudgetAmount',
                        hues: ['#0fff03', '#eb0707'],
                        scales: '10'
                }]
                }
            }
        }
    }]
}]

Above mentioned one is json, Here titie value will be get in a list please help me...

my code is:

string dashletsConfigPath = Url.Content("~/Content/Dashlets/Dashlets.json");
string jArray = System.IO.File.ReadAllText(Server.MapPath(dashletsConfigPath))

List<string> lists = new List<string>();
JArray list = JArray.Parse(jArray);
var ll = list.Select(j => j["dashlets"]).ToList();

© Stack Overflow or respective owner

Related posts about c#

Related posts about JSON