This is a kind of specific question and I couldn't get any information on this topic in the javadoc of [Gson](https://www.javadoc.io/doc/com.google.code.gson/gson/2.8.4).

---

Currently, I'm trying to parse an Json(1)`{ "foo":"bar", "bar":"foo" }` to an Object `Entity`. Normally I would map these values to the `Entity` Object with the fields `foo` and `bar`, however I'd like to be more *independent* from the API. 

---

For (1) I'd have 

```
public class Entity {
String foo;
String bar;
}

```

But if we test another Endpoint the resulting Json (2) would look like 

`{ "notFoo":"bar", "notBar":"foo" }`

which makes my previous constructed `Entity` *useless*, and I'd need to create a new Class with the respective fields for that.

---

So my actual question is:

1. Is there a **generic** (more generic than my example) approach to 
push the Json into a `GenericEntity` -> `g.fromJson(response.getBody(),GenericEntity.class);` that every *field* of the json will be successfully mapped, even when using different Endpoints?
2. Alternatively, are there other dependencies which support that out of the box?