Consider this:
List<String> users = repo.findAllById(id):
And this:
Public Users{
int id;
string name;
}
The list of users contain a json of users with id and names.
My question is, how do I convert the list of strings(json) into a list of users. Thanks everyone.
Eg. of list:
[user1:
{
“id”: “24”,
“name”: “name”
}
user2:
{
“id”: “24”,
“name”: “name”
}
]
2
Answers
Is there a reason why you want the list to contain strings, and not a User object? If not, you could try this:
I am not quite sure how is your
List<String> users
data structure looks like?You can do the convert using as below.
If you would like to have an accuracy answers
please provide more detail such
sql
?JDBC
orJPA
?