Skip to content

Commit

Permalink
modifying qald json deserialization
Browse files Browse the repository at this point in the history
ignores unknown fields while reading the QALD json
  • Loading branch information
nikit-srivastava committed Apr 28, 2022
1 parent b562d38 commit 13fa31c
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -109,6 +110,7 @@ public static Object readJson(final byte[] inputJson, final Class<?> type) throw
*/
public static Object readJson(final InputStream in, final Class<?> type) throws JsonParseException, JsonMappingException, IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.disable(MapperFeature.USE_GETTERS_AS_SETTERS);

return mapper.readValue(in, type);
Expand Down

0 comments on commit 13fa31c

Please sign in to comment.