I have a Data Access Layer that uses a json API.
If the structure of the program looks like:
Controller | Data Access Layer
Is it best to convert the response strings into objects in the Data Access Layer and return them as types to the Controller
Should I be returning strings back to the Controller, when it makes requests, and deserializing the json string there?
I figured that if I ever need to attach a new API to the program then passing objects to the Data Access Layer will hide the fact I'm communicating via json. However, I also realise that having a method like, in the data access layer:
public Foo Get(Bar bar)
will have to serialize the object to json, make the request and then deserialize back to an object. This clearly breaks the single responsibility principle.