/ Published in: Java

(De-)serialising an HPPC map using the jackson HPPC module.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* Project website: https://github.com/FasterXML/jackson-datatype-hppc Maven: <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-hppc</artifactId> <version>2.0.0-RC1</version> </dependency> */ import com.carrotsearch.hppc.ObjectObjectOpenHashMap; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.hppc.HppcModule; // Serialize: // fill map ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new HppcModule()); // De-serialize: ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new HppcModule()); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Comments
