Not entirely sure where to ask for help with this, but I'm having an issue 
when deserializing a json string to an object.

My setup is as follows:

//Test.java
public class Test {

@CustomAnnotation("integer test")
public int integerTest = 3;
@CustomAnnotation("string test")
public String stringTest = "Hello world";
public boolean isNotInJson = true;
public Test() {
//some irrelevant stuff
}
public void myMethod() {
//more irrelevant stuff
}
}

//Main.java
public class Main {
public static void main(String[] args) {
Test test = new Test();
String jsonString = "{\"integerTest\": 5, \"stringTest\": \"Goodbye 
world\"}";
ObjectMapper mapper = new ObjectMapper();
mapper.readerForUpdating(test).readValue(jsonString);
/*
* This exception is thrown for ^
* com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize 
Class me.test.CustomAnnotation (of type annotation) as a Bean
*/
}
}

When trying to read the string into the already existing instance of 
"Test", I get the exception thrown that "CustomAnnotation" can't be 
deserialized as a "Bean". I don't want this, I want the annotation to be 
ignored, and for the values of the fields to simply be updated to whatever 
the json provides.

Does anyone know either A. what I'm doing wrong, or B. how to go about 
doing this in a fashion that will work?

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to