1

I am receiving the below json object from service:

[{
    "EmployeeID": 8513,
    "EmployeeName": "Afridi,Masoom Khan",
    "EmployeeMailID": "Masoom.Afridi@COELAB.COM",
    "Vertical": "INFRA",
    "ProjectID": "000000000002105",
    "ProjectDescription": "ITH - Data Center Impl.",
    "PeriodEndDate": "19-JUN-16",
    "TimeSheetID": "0001612322",
    "CreationDate": "27-JUN-16",
    "SubmissionDate": "27-JUN-16",
    "TimeSheetStatus": "NA",
    "Approver": "MISHRA,BISWAJIT",
    "ApproverMailID": "biswajit.mishra@COELAB.COM"
}, {
    "EmployeeID": 8513,
    "EmployeeName": "Afridi,Masoom Khan",
    "EmployeeMailID": "Masoom.Afridi@COELAB.COM",
    "Vertical": "INFRA",
    "ProjectID": "000000000002105",
    "ProjectDescription": "ITH - Data Center Impl.",
    "PeriodEndDate": "26-JUN-16",
    "TimeSheetID": "0001612324",
    "CreationDate": "27-JUN-16",
    "SubmissionDate": "27-JUN-16",
    "TimeSheetStatus": "NA",
    "Approver": "MISHRA,BISWAJIT",
    "ApproverMailID": "biswajit.mishra@COELAB.COM"
}]

I would like to convert the given object into below json format:

[{
    "ProjectID": "000000000002105",
    "ProjectDescription": "ITH - Data Center Impl.",
    "Approver": "MISHRA,BISWAJIT",
    "ApproverMailID": "biswajit.mishra@COELAB.COM",
    "Employee": {
        "EmployeeID": 8513,
        "EmployeeName": "Afridi,Masoom Khan",
        "EmployeeMailID": "Masoom.Afridi@COELAB.COM",
        "Vertical": "INFRA",
        "TimeSheet": [{
            "PeriodEndDate": "26-JUN-16",
            "TimeSheetID": "0001612324",
            "CreationDate": "27-JUN-16",
            "SubmissionDate": "27-JUN-16",
            "TimeSheetStatus": "NA"
        }, {
            "PeriodEndDate": "19-JUN-16",
            "TimeSheetID": "0001612322",
            "CreationDate": "27-JUN-16",
            "SubmissionDate": "27-JUN-16",
            "TimeSheetStatus": "NA"
        }]
    }
}]

could you please help.

currarpickt
  • 2,290
  • 4
  • 24
  • 39

0 Answers0