posted 9 years ago
EDIT: Nevermind, I did it. I'll post the code later.
Right, in the beginning I thought it'd be quite easy to do what I want, in practice though I can't figure it out.
Basically, I want to create a Json that contains all of my DB table's data. Something along the lines of:
All these names though are retrieved from the DB and held in Lists. My first reaction was to iterate the Lists, after specifying an ArrayBuilder outside the loop, and add these objects. Problem is it doesn't work. Either I don't add the elements correctly or it doesn't write the output correctly.
How would you write a similar Json iterating a List?
Netbeans 11 - JavaEE 8 - WildFly 14 - Spring Boot 2.x