json.getClass().equals(JsonObject.class) is a little bit safer.  We don't have to deal with multiple class loaders, but just sayin'.