I have to consume a JSON Rest api (for mobile). This api returns a field that is changing like so : (string, int, null, array, object or array of object)
{"field": [{"id": 12, "value": "string value"}]} //array of object
{"field": 12345} //int
{"field": "string"} //string
{"field": {"id": 1, "value": "I'm an object now"}} //object
{"field": ["array", "of", "string"]} //array of string
I may be possible to change the server response to be able to do some standardisation, which could be great! Right now I had to create an adapter (with GSON) but this solution have is limitations, especially with performances and maintainability..
How could I create a good response that will be easy to understand and use?