VenomFangs VenomFangs - 20 days ago 5
JSON Question

General Java Method that Queries DB and Returns Results in Json Format

What I'm looking for seems pretty straight forward to me, but my googles have failed.

I want a method that allows me to run any query and get the results in json format.

The trick is I don't want the results to need java objects as part of the process (DTOs, VOs, etc).

Any quick/easy/clean ways of doing this?

Answer

Jackson has some pretty nice ways of doing it. There's some examples in this answer that should work wonders for you.

Alternatively, if Jackson isn't available to you, you could check out this