I am calling vendor Api to get json data, I want to convert that json to my custom structure.
Here is example
When I call student data, vendor returns data as below
{
"Students": [
{
"FirstName":"Abc",
"LastName":"pqr"
},
{
"FirstName":"pqr",
"LastName":"pqccr"
}
]
}
When I call employee data, it returns as below
{
"Employee": [
{
"FName":"Abc",
"LName":"pqr"
},
{
"FName":"pqr",
"LName":"pqccr"
}
]
}
I want to convert this to my own json format so that it would be easy to retrieve and manipulation something as below
{
"Person": [
{
"First_Name":"Abc",
"Last_Name":"pqr"
},
{
"First_Name":"pqr",
"Last_Name":"pqccr"
}
]
}
I am using system.text.json to serialized and deserialize.
How can I convert to this common structure?
Trying with system.text.json to deserialize but don't have any idea on how can I convert to common structure
convert json objects to model and use addrange to assign the data. Tried an example as below. Consider test1 class as students and test2 as employee