Vasily Scherbakov
05/09/2021, 1:08 PMclass NeuralNetworkModelingModuleInput (
@JsonProperty("module")
val ModuleName: String = "neural_network_modeling",
...
)
I expects that field ModuleName would be mapped to "module" field of json. And for deserialization its work correct, but when i try to serialize this class, i get json with field "moduleName". Seems like object mapper simply ignore JsonProperty annotation. Also this may ocurred cause of for deserialization i use mapper in ktor server, and standalone mapper for serialization:
private fun<T> serialize(obj: T): String {
return mapper
.configure(SerializationFeature.INDENT_OUTPUT, true)
.writeValueAsString(obj)
}
Can anyone please help me?Vasily Scherbakov
05/09/2021, 1:32 PM@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
this annotation to my class. but now occured another problem: all fields was duplicated after serialization. For example, for fied ModuleName with JsonName module after serialization exist both fields: module and ModuleNameVasily Scherbakov
05/09/2021, 1:32 PM"module" : "neural_network_modeling",
"moduleName" : "neural_network_modeling"
Umar Ata
05/09/2021, 1:50 PMVasily Scherbakov
05/09/2021, 1:52 PMUmar Ata
05/09/2021, 1:57 PMUmar Ata
05/09/2021, 1:57 PMVasily Scherbakov
05/09/2021, 1:57 PMVasily Scherbakov
05/09/2021, 2:10 PMDave K
05/09/2021, 10:50 PMDave K
05/10/2021, 12:59 AMVasily Scherbakov
05/10/2021, 6:12 AMVasily Scherbakov
05/10/2021, 6:14 AM