Provides a shared context for using Jackson
public enum JacksonContext { | |
INSTANCE; | |
private final CBORFactory factory = new CBORFactory(); | |
private final ObjectMapper mapper = new ObjectMapper(factory); | |
public static Map<String, Object> jsonToMap(JSON json) throws IOException { | |
try (CBORParser parser = INSTANCE.factory.createParser(json.asInputStream())) { | |
return INSTANCE.mapper.readValue(parser, new TypeReference<Map<String, Object>>() { }); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment