A serialized protocol buffer doesn't include any type information, so before you can parse one you have to know in advance which type you're expecting. If you want to be prepared to accept either A or B, then a good solution is to put both types inside a oneof in a parent message, and then just parse the parent message normally.
It doesn't matter which protobuf implementation created the .pb file, since all implementations use the same wire format.
That is true that the Java lite implementation doesn't support reflection and doesn't include descriptors, so it cannot serialize protos to JSON. If you can stick to the binary format then that would be ideal since that format is useable everywhere.