Hello, I have this scenario where I need to deserialize a JSON that can have a different type for the same key, depending on a server response I can't control.
Example:
Copy code
{ "myKey": true } // First server response
{ "myKey": "someValue" } // Second server response
I don't know in advance what kind of type the value will be, so I came up with this solution. I would like your professional opinion: Is there a better way to do it ? Can it be improved ?
If you find it alright, I'm leaving the code snippet for those who might run into the same use case.