I am using Google\'s GSON package http://code.google.com/p/google-gson/
I am converting JSON to Java.
I have this fragment of code where I do the conversion.
Gson does not currently have a simple mechanism for polymorphic deserialization, other than implementing custom deserialization processing. The next release looks like it will provide a built-in solution.
Previous StackOverflow.com Questions And Answers (Some With Examples) On This Topic:
Sounds like you want to create a custom deserializer if you need to check the values, or an instance creator if you only need to create an instance based on type.