In general, we name all camel-like, but sometimes with the third-party interface, also encounter some wonderful things, such as the first letter capital .... Well, what the hell is this, the other side is so demanding, so we have to write it.
Thus, the first way: capitalize the first letter of the field in the class, simply brute, and then generate the setter getter. Then test ... Get on your knees.
Found or lowercase, the forehead drops a mother Ah, nen is what is the son ah.
It turns out that when Jackson turned the class into JSON, he looked at the setter getter method. That's JavaBean. Search Karma.
So, can we specify the field name of the JSON, like what's called in the class, and my JSON is called What the fuck
Yes, I can.
At this point, a self-explanatory note is needed: @JsonProperty
Everything is done, you can call whatever you want.
And to be on the safe side, it's best to add this annotation to each field, so that's the comment on the field?
No no No
We tested, the capital is no problem, but found that there will be more than a lowercase letter, well, it seems that the Getter played a role, simple
Let's just add the annotations to the setter and getter method.
Everything is done!!! It's so nice.
How do I resolve a key in JSON that requires an initial capitalization?