Skip to content

Commit

Permalink
jackson config switch to older api (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
SomkaPe authored Jan 10, 2020
1 parent 43d727b commit a2e0314
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/main/java/com/microsoft/aad/msal4j/JsonHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,23 @@
package com.microsoft.aad.msal4j;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.json.JsonReadFeature;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.json.JsonMapper;

class JsonHelper {
static ObjectMapper mapper;

static ObjectMapper mapper = JsonMapper.builder()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS, true)
.serializationInclusion(JsonInclude.Include.NON_NULL)
.build();
static {
mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true);
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
}

static <T> T convertJsonToObject(final String json, final Class<T> clazz) {
try {
Expand Down

0 comments on commit a2e0314

Please sign in to comment.