Can anyone help me how to create a JSON Object from the database?
This is what the JSON output should look like:
{“devicelist”:{
“de
With jOOQ, you could produce a similar JSON list from your database:
String json = create.select(TYPE, NAME, DEMO)
.from(REGISTER_DEVICE)
.fetch()
.formatJSON();
The JSON String would look like this (configurable):
{fields:["TYPE","NAME","DEMO"],
records:[["01","CAM","Livingroom"],["15","CAM","Kitchen"]]}
See more here. Alternatively, you can use your RDBMS's native SQL/JSON capabilities to create arbitrarily nested JSON documents.
(Disclaimer: I work for the company behind jOOQ)