rharter / auto-value-gson

AutoValue Extension to add Gson De/Serializer support
Apache License 2.0
603 stars 103 forks source link

Parse json object with varying data types #223

Closed Wajahat-Jawaid closed 4 years ago

Wajahat-Jawaid commented 4 years ago

Inside my json object, there is the block

"structuredFormat": {
                "Mon": "closed",
                "Tue": [
                    "0900-1330",
                    "1700-2030"
                ],
                "Wed": [
                    "0900-1700"
                ],
                "Thu": "24h",
                "Fri": [
                    "0000-1330",
                    "1700-2030"
                ],
                "Sat": "24h",
                "Sun": "24h"
            }

Moreover, it's variable as well that on which day which kind of data type is associated with. Like in one case, on Mon, there can be a simple string as mentioned or can be an array like in Tue. I've tried to use Object as the property type in my model class but AutoValue doesn't support that.