I have a simple spring-boot app with one Rest API. I want to send Student data (in JSON format)by consuming client rest web service. But I want to envelop this student info with "DATA" and that should be dynamic like below.
if(dynamic == true)
// envelop the student information in "DATA" and send student info to client.
else
// Do not envelop student data and send student info to client.
Current JSON format of the student.
{
"id": "1-abcd",
"name": "stack",
"address": "Pune"
}
Expected json format.
{
"data": {
"id": "1-abcd",
"name": "stack",
"address": "Pune"
}
}
Student class is as below:
Class Student{
String id;
String name;
String address;
}