Reputation: 3166
I don't know why java has no native json parser, pretty odd, and I cam across different jars just now, like GSON, but I am still relatively new to it.
When I try to system.out.println
my query:
System.out.println(this.db.fetchAll(query));
I am getting this kind of list
[[1, user, pass], [2, another, test], [3, argh, test]]
How to i send this back to the browser as json?
Upvotes: 1
Views: 172
Reputation: 26084
Gson gson = new Gson();
String json = gson.toJson(this.db.fetchAll(query));
Upvotes: 1