I have some wpf app where I store data based on user's input in some local json file. roughly it looks something like:
{
"Database": {
"instance": "",
"userName": "",
"password": "",
},
"Website": {
"ip": "111.111.111.111",
"port": "8080"
},
"User": [],
"ReportService": {
"instance": "fff",
"ip": "111.111.121.212",
"port": "88"
}
}
suppose I have an "Import" button witch let the user to import other json file.
My question is how to verfity that the imported json file has same structure as mine?
I mean same objects with the fields like username,password,...
Because I want to validate the imported json to verify that he has the same structure as I expect.
Edit:
My solution for now is try, catch
but I'm sure that there is more elegant solution