Hello!
On Sat, Oct 19, 2013 at 1:45 AM, <mr...@gmail.com> wrote:
>
> Why does nginx return e.g 'GET/numbers/3' as an array with 1 object member
> [{"number":"three"}]?
1. For the sake of consistency. The result set MAY return multiple rows.
2. Also, it's not easy for the ngx_rds_json module to know ahead that
there is only one row in the result set because the RDS (Resty DBD
Stream) format is a streaming format.
> On common REST implementation it should return
> directly as an member object of the array if it's only one object inside
> {"number":"three"}. Any tips/tricks to overcome this?
>
You can always use ngx_lua module to generate the result in any format
that you want. See
https://github.com/chaoslawful/lua-nginx-module#ngxlocationcapture
and
http://www.kyne.com.au/~mark/software/lua-cjson.php
Regards,
-agentzh