How can I parse with Moshi double nested dynamic o...
# squarelibraries
l
How can I parse with Moshi double nested dynamic objects? I can have different types of
trigger
in my JSON. Then, for
trigger
type
SENSOR
I can have (nested) different types of
condition
(examples see in thread 🧵:
Copy code
{
    "trigger":{
        "type":"TIME",
        "hour":"13:05"
    }
}

{
    "trigger":{
        "type":"SENSOR",
        "condition":{
            "type":"ALWAYS"
        }
    }
}

{
    "trigger":{
        "type":"SENSOR",
        "condition":{
            "type":"THRESHOLD",
            "value":"50"
        }
    }
}