yes that is possible, you can write sql statement and get the data to array and then you can encode to JSON format