i have this API that i want to creat a dynamic object. My point here is to have normal object to deal with rather than what this API returns to me, i can't controll this API so the retrived data can't be modified, this is the body, and it represnet a view in Database
Also i think reflection could help me in this case, any idea....
Request Body:
{
"ViewName": "Person",
"ViewOutput": "Name, Email, Number",
"ViewFilter": [
{
"filterKey": "Number",
"filterValue": "532000000"
}
]
}
I want the ViewName + ViewOutput+ ViewFilter to be paramterized, ViewName it will take single value, ViewOutput will be array of string ViewFilter will be list of filteration ("FilterKey", "FilterVlaue") because it could be mutliple filteration value like this:
"ViewFilter": [
{
"filterKey": "Number",
"filterValue": "532000000"
},
{
"filterKey": "Email",
"filterValue": "test1@test.ps"
}
]
This is What API Return to me, a list of Person Keys and values,
Response:
{
"ResponseCode": "0",
"ResponseMessage": "Success",
"NumberOfRecords": "1",
"MainData": [
{
"recordData": [
{
"dataKey": "Name",
"dataValue": "Test Name"
},
{
"dataKey": "Email",
"dataValue": "test@test.ps"
},
{
"dataKey": "Number",
"dataValue": "532000000"
}
]
}
]
}
What i want to be the output is like this:
"Person": [
{
"Name":"Test",
"Email":"test@test.ps",
"Number":"532000000",
}]
Aucun commentaire:
Enregistrer un commentaire