I'm consuming an api that uses an empty string for...
# serialization
s
I'm consuming an api that uses an empty string for a null but sends an object when the key is not null like so:
Copy code
"mods":{"mod1":""}
"mods":{"mod1":{"comp":">=","point":3}}
Is there a way to construct a class or annotate the property to deal with this?
d
I was battling with this yesterday. Basically inferring type from the payload is not possible.
Nvm, I'm wrong.
s
That’s the route I ended up going down. It wasn’t too painful. I made the custom serializer on the object containing the switchable key and returned a default empty mod1 object if the value was a json literal type.