rds-json generate json with index key on first level of array

Mauro Stettler mauro.stettler at gmail.com
Mon Feb 25 07:52:38 UTC 2013

Hello Nginx list

I'm using OpenResty with libdrizzle to provide a faster API to query
certain things from my db.

My current config is like this:

        location ~* ^/resty/usersTable/userId/([0-9\,]+)$  {
            set_unescape_uri $uid $1;
            drizzle_query 'select  id, nickname, age, age_p, city, plz,
wio_plz, gender from users where id in ($uid)';
            drizzle_pass projectdb;
            rds_json on;

So this works fine and it gives me the expected output.

My problem is that if I query many user IDs i'm only getting a flat array
of arrays without index key. But to improve the processing speed on the
client side, I would like to define that the 'id' field should be the first
level index in the returned array. I am trying to show what I mean:

Current output:





What I want:





Is there some way how I can define a first level index key in rds-json? I
already checked the `rds_json_root` parameter, but this doesn't seem to be
what I'm looking for.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130225/093dc41a/attachment.html>

More information about the nginx mailing list