Jackson throws JsonMappingException on deserialize; demands single-String constructor?

Oh, so once again I found out the answer AFTER I posted this question (even though I tried a lot of things before posting).

What I did to solve this was to use the @JsonCreator annotation. I simply annotated my static Create method, like this:

@JsonCreator
public static ProtocolContainer Create(String jsonString)
{

    ProtocolContainer pc = null;
    try {
        pc = mapper.readValue(jsonString, ProtocolContainer.class);
    } catch (JsonParseException|JsonMappingException|IOException e) {
        // handle
    }

    return pc;
}

And then problem solved.

Leave a Comment