Ok, so .... what are classes involved? And input JSON?

-+ Tatu +-

On Mon, Dec 11, 2017 at 1:50 PM, Remya <[email protected]> wrote:

> I am trying to deserialize a JSON string using jackson-databind
> Objectmapper which has a set of Enum attributes within it.
>
>
> This happens when an unknown attribute, which is not defined in the enum
> comes in the JSON. Please find below the object mapper configuration that I
> am using.
>
>     ObjectMapper objectMapper = new ObjectMapper();
>     objectMapper.setVisibility(PropertyAccessor.ALL, Visibility.NONE);
>     objectMapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
>     objectMapper.setSerializationInclusion(Include.NON_NULL);
>    objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, 
> false);
>
> But, deserialization (objectMapper.readValue(jsonText, .class);) throws
> this error. "Test" is the unknown attribute that comes in the JSON String
> to be deserialized.
>
> com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot
> deserialize Map key of type com..* from String "Test": not a valid
> representation, problem: 
> (com.fasterxml.jackson.databind.exc.InvalidFormatException)
> Cannot deserialize Map key of type com.... from String "Test": not one of
> values excepted for Enum class: [ ]
>
>
> Could someone please help me out with this issue?
>
>
> Thanks!
>
> --
> 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.
>

-- 
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