Different format:
You can use Views on the server to decide during runtime which properties to include. The new client could then request the same content as old client, but with a different parameter/header or via different API path that simply uses a new view with new properties.
Same format:
If the old client doesn't support the new format, you cannot simply force it to support it without modifying the client. In fact, if you could do something like this, it would be quite dangerous, as it would imply existing applications could not rely on their format restrictions.
However, if you can modify old client, here's something you can do:
- Add
@JsonIgnoreProperties(ignoreUnknown = true)
to the POJO in old client
- If you can't modify POJO, but can access ObjectMapper:
objectMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- If you can access ObjectMapper, but don't want to affect all other POJOs too, you can mix-in the annotation just for that one POJO