Multiple Type Defs for same name?

I have a particular object that comes through and can be in one of two types: The first is a simple string, the other is an object containing multiple objects. Is there anyway I can define the mapping so I can detect and digest both? Seeing as how it can tell one is an object and the other is a string well enough to give errors about it, it seems it should be able to contain the logic to actually digest such a thing.