Adding the JSON flags returns the exact same result but in JSON format.
127.0.0.1:6379> ZEESQL.EXEC DB COMMAND "INSERT INTO foo VALUES('AAA', 2, 'BBB'),('CCC', 3, 'DDD');"
1) 1) "DONE"
2) 1) (integer) 2
127.0.0.1:6379> ZEESQL.EXEC DB COMMAND "INSERT INTO bar VALUES('AAA', 2, 'BBB'),('CCC', 3, 'DDD');" JSON
"{\"result\":\"done\",\"modified_rows\":2}"
Another example is when the command returns some rows.
The returned JSON is formatted for saving bytes on the network, not for readability.
However, the result looks like this:
The rows key contains the actual result set, each row is an object with a key the name of the column and with value the actual value of the row.
Then there is the number_of_rows key, an integer that describes how many rows are returned in this result set.
The columns field maps the name of the column to their type.
Overall returning JSON from zeeSQL is very simple, just add the JSON flag to your command and you are done.
About zeeSQL
zeeSQL is a Redis Module that provides SQL capabilities to Redis. It allows the creation and management of several SQL databases, each one independent from the other. Moreover, zeeSQL provides out-of-the-box secondary indexes capabilities, allowing fast and easy search by value in Redis.