Im trying to convert a java object to a json according to an API's declared pattern, using jakson. but I couldnt figure it out. how should I do that?
Here are my classes
ProcessValueBaseDto
package com.ir.tsn;
public class ProcessValueBaseDto implements Serializable {
private String id;
private ProcessValue value;
}
//methods Ommited
ProcessValue
package com.ir.tsn;
public interface ProcessValue<T> extends Serializable {
void setValues(T values);
}
//methods Ommited
ProcessValueDto
package com.ir.tsn;
public class ProcessValueDto implements
ProcessValue<List<String>> {
private List<String> values;
}
//methods Ommited
the excpected json should be like this
{
"id": "id1",
"value": {
"com.alz.ProcessValueDto": {
"values": [
"500000000"
]
}
}
}
com.alz.ProcessValueDto is the name of one of the ProcessValue.class implementations in API
thank you in advance
Aucun commentaire:
Enregistrer un commentaire