使用Linq读取记录的JSON文件

时间:2014-10-18 12:00:22

标签: json linq c#-4.0

以下是我的JSON文件。我必须为每个页面提供字段,并为逗号分隔字符串中的每个类型提供字段。请帮助您了解如何使用Linq

示例:如果我想要" Type = customFields"定义为" page1" ,必须以逗号分隔的ProjectID,EmployeeID,EmployeeName,hasExpiration等输出

 {
"Fields": {
"Pages": {
  "Page": {
    "-Name": "page1",
    "Type": [
      {
        "-TypeID": "CUSTOMIZEDFIELDS",
        "Field": [
          "ProjectID",
          "EmployeeID",
          "EmployeeName",
          "HasExpiration",
          "EndDate",
          "OTStrategy",
          "Division",
          "AddTimesheets",
          "SubmitTimesheets",
          "ManagerTimesheetApprovalRequired",
          "OTAllowed",
          "AddExpenses",
          "SubmitExpenses",
          "ManagerExpenseApprovalRequired",
          "SendApprovalEmails"
        ]
      },
      {
        "-TypeID": "CFDATASET",
        "Field": [
          "ProjectID",
          "EmployeeID",
          "EmployeeName",
          "HasExpiration",
          "EndDate",
          "OTStrategy",
          "Division",
          "AddTimesheets",
          "SubmitTimesheets",
          "ManagerTimesheetApprovalRequired",
          "OTAllowed",
          "AddExpenses",
          "SubmitExpenses",
          "ManagerExpenseApprovalRequired",
          "SendApprovalEmails"
        ]
      },
      {
        "-TypeID": "CFDATASETCAPTION",
        "Field": [
          "ProjectID",
          "EmployeeID",
          "EmployeeName",
          "HasExpiration",
          "EndDate",
          "OTStrategy",
          "Division",
          "AddTimesheets",
          "SubmitTimesheets",
          "ManagerTimesheetApprovalRequired",
          "OTAllowed",
          "AddExpenses",
          "SubmitExpenses",
          "ManagerExpenseApprovalRequired",
          "SendApprovalEmails"
            ]
          }
        ]
      }
    }
  }
}

0 个答案:

没有答案