簡體   English   中英

Encoding Python object (with Python Convention) in JSON with Java naming convention

[英]Encoding Python object (with Python Convention) in JSON with Java naming convention

我需要將 object 從我的 Python 項目發送到我的 Java 項目,通過 Z0ECD11C1D7A28740F8D1 編碼它。

但是,根據命名約定, python 具有如下字段

variable_name

而 Java 有如下字段

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

如果您使用的是 Jackson 庫,您可以使用:

@JsonProperty("variable_name") // same name come from python app
private String variableName;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM