https://kotlinlang.org logo
Title
l

Lukasz Kalnik

07/28/2022, 3:49 PM
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 🧵:
{
    "trigger":{
        "type":"TIME",
        "hour":"13:05"
    }
}

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

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