Q:

@JsonProperty name with spaces

Is it allowed to have spaces in @JsonProperty name? i.e.
@JsonProperty("Jon Snow")
private String jonSnow = "Lord";

// getter & setter are omitted

I expect to get the following output:
{
   "Jon Snow" : "Lord"
}

But the actual result is:
{
   "jonSnow" : "Lord"
}

I use jackson-core v2.8.8, jackson-databind v2.8.8.1, and jackson-annotations v2.8.8.

A:

The problem was that I was using @JsonProperty annotation from the wrong Jackson library.
I had import org.codehaus.jackson.annotate.JsonProperty; (Jackson v1) which I had to change to import com.fasterxml.jackson.annotation.JsonProperty; (Jackson v2), to be consistent with the library I was using.
I've found the answer in comments to this question: @JsonProperty not working as expected

