-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vavr serialization can ignore field? #119
Labels
Comments
what object are you serializing? can you provide a reproducer? |
io.vavr.collection.HashMap |
you should register the import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.vavr.collection.HashMap;
import io.vavr.jackson.datatype.VavrModule;
import org.junit.Test;
public class Iss119 {
private final HashMap<String, String> items = HashMap.of("id", "451565338509840384");
@Test
public void unregistered() throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper();
System.out.println(mapper.writeValueAsString(items));
// {"async":false,"lazy":false,"empty":false,"traversableAgain":true ...
}
@Test
public void registered() throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper()
.registerModule(new VavrModule()); // <-- register Vavr Jackson Module
System.out.println(mapper.writeValueAsString(items));
// {"id":"451565338509840384"}
}
} |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
vavr serialization
I want serialization
The text was updated successfully, but these errors were encountered: