I have a List of an Object.
public class BusStop {
private String description;
private float lat;
private float lng;
//getter and setter
}
Of which I try to put all its content inside a variable of type String.
I tried this:
StringBuilder aux = new StringBuilder();
busStop.forEach(aux::append);
return aux.toString();
But the answer I get is not what I want.
en.yo.app.model.BusStop @ 6cdf7f4bes.yo.app.model.BusStop @ 15820f4bes.yo.app.model.BusStop @ 2022ad11
And this is just what I want to achieve
[{"lat": 43.482243622643026, "lng": - 3.7942432892720035, "description": "1"}, {"lat": 43.47775946266253, "lng": - 3.8052296173970035, "description": "2"}, {"lat": 43.474520695703184, "lng": - 3.822567416469269, "description": "3"}]