Is there a way I can parse a Json list with two di...
# serialization
a
Is there a way I can parse a Json list with two different models? For example a list that contains a list of posts and a list of comments? Something like this:
Copy code
"""
           [
                {
                    // Posts
                },
                {
                    // Comments
                }
           ]
        """
d
a
Does this work without having the models to be inherited?
d
you mean without common interface/sealed class? no i don't think it would work
a
Yeah, in my case the models are totally different
d
well you can have empty interface/sealed class with implementations having completely different fielsd
👍 1
k
honestly that model looks wrong
a
I agree 💯. It's one of the worst APIs I've ever dealt with. It's not mine and I can't change it unfortunately.
😢 1