im making a rest controller which return json. i get this data from database, mapping in to java class using setter getter.
{
"example": null,
"this": null,
"is": null,
"only": null,
"example": null,
"foo": null,
"bar": null,
"blabla": null,
"lala": null
}
its because the data in database not present. but i want the data to be like this:
{
"example": "" ,
"this": "",
"is": "",
"only": "",
"example": "",
"foo": "",
"bar": "",
"blabla": "",
"lala": ""
}
i have more than 100 fields. so i think its not good to use if else in every variable.