Reputation: 2508
I need to send an object from my Python project to my Java project by JSON encoding it.
However, according to naming conventions, python has fields like
variable_name
while Java has fields like
private String variableName
How to encode the python object with the above variable (variable_name) in JSON, so that I can decode that JSON object into a Java model (having field as variableName)?
Upvotes: 1
Views: 88
Reputation: 60046
If you are using Jackson library, You can use :
@JsonProperty("variable_name") // same name come from python app
private String variableName;
Upvotes: 2