{"id":13635865,"url":"https://github.com/openresty/rds-json-nginx-module","last_synced_at":"2025-07-23T19:03:26.512Z","repository":{"id":1021330,"uuid":"468617","full_name":"openresty/rds-json-nginx-module","owner":"openresty","description":"An nginx output filter that formats Resty DBD Streams generated by ngx_drizzle and others to JSON","archived":false,"fork":false,"pushed_at":"2024-08-17T12:35:58.000Z","size":375,"stargazers_count":152,"open_issues_count":5,"forks_count":40,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-06-07T18:07:49.340Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openresty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2010-01-12T09:59:46.000Z","updated_at":"2025-03-12T15:44:30.000Z","dependencies_parsed_at":"2023-11-23T12:45:00.105Z","dependency_job_id":null,"html_url":"https://github.com/openresty/rds-json-nginx-module","commit_stats":{"total_commits":210,"total_committers":8,"mean_commits":26.25,"dds":"0.14761904761904765","last_synced_commit":"9f9690f59afaacfd52a6ca89556b339a2ae0af86"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/openresty/rds-json-nginx-module","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Frds-json-nginx-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Frds-json-nginx-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Frds-json-nginx-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Frds-json-nginx-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openresty","download_url":"https://codeload.github.com/openresty/rds-json-nginx-module/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Frds-json-nginx-module/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266737568,"owners_count":23976389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T00:00:53.395Z","updated_at":"2025-07-23T19:03:26.486Z","avatar_url":"https://github.com/openresty.png","language":"C","funding_links":[],"categories":["Modules","Third Modules","Third Party Modules"],"sub_categories":["C Modules"],"readme":"Name\n====\n\nngx_rds_json - an output filter that formats Resty DBD Streams generated by ngx_drizzle and others to JSON\n\nTable of Contents\n=================\n\n* [Name](#name)\n* [Status](#status)\n* [Synopsis](#synopsis)\n* [Description](#description)\n* [Directives](#directives)\n    * [rds_json](#rds_json)\n    * [rds_json_buffer_size](#rds_json_buffer_size)\n    * [rds_json_format](#rds_json_format)\n    * [rds_json_root](#rds_json_root)\n    * [rds_json_success_property](#rds_json_success_property)\n    * [rds_json_user_property](#rds_json_user_property)\n    * [rds_json_errcode_key](#rds_json_errcode_key)\n    * [rds_json_errstr_key](#rds_json_errstr_key)\n    * [rds_json_ret](#rds_json_ret)\n    * [rds_json_content_type](#rds_json_content_type)\n* [Installation](#installation)\n* [Compatibility](#compatibility)\n* [Author](#author)\n* [Copyright \u0026 License](#copyright--license)\n* [See Also](#see-also)\n\nStatus\n======\n\nThis module is considered production ready.\n\nWe need your help! If you find this module useful and/or interesting, please consider joining the development!\nCommit bit can be freely delivered at your request ;)\n\nSynopsis\n========\n\n```nginx\nserver {\n    location /mysql {\n        drizzle_query 'select * from cats';\n        drizzle_pass my_mysql_upstream;\n\n        rds_json on;\n    }\n\n    location /foo {\n        if ($arg_limit !~ '^\\d{2}$') {\n            rds_json_ret 400 'Bad \"limit\" argument';\n        }\n\n        drizzle_query \"select * from dogs limit $arg_limit\";\n        drizzle_pass my_mysql_upstream;\n\n        rds_json on;\n    }\n    ...\n}\n```\n\nDescription\n===========\n\nThis module provides an output filter that can format the RDS outputs\ngenerated by [ngx_drizzle](https://github.com/openresty/drizzle-nginx-module)\nand [ngx_postgres](https://github.com/FRiCKLE/ngx_postgres/) modules to JSON.\n\n[Back to TOC](#table-of-contents)\n\nDirectives\n==========\n\n[Back to TOC](#table-of-contents)\n\nrds_json\n--------\n**syntax:** *rds_json on|off*\n\n**default:** *rds_json off*\n\n**context:** *http, server, location, if location*\n\nEnables or disables the output filter of this module.\n\n[Back to TOC](#table-of-contents)\n\nrds_json_buffer_size\n--------------------\n**syntax:** *rds_json_buffer_size   \u0026lt;bytes\u0026gt;*\n\n**default:** *rds_json_buffer_size \u0026lt;page-size\u0026gt;*\n\n**context:** *http, server, location, if location*\n\nControls the buffer size used by this module. default to the page size (4k/8k).\nThe bigger the buffer size, the less streammy the conversion\nwill be. But usually increasing the buffer size\ndoes help reduce CPU time.\n\n[Back to TOC](#table-of-contents)\n\nrds_json_format\n---------------\n**syntax:** *rds_json_format  normal|compact*\n\n**default:** *rds_json_format normal*\n\n**context:** *http, server, location, if location*\n\nControls the output JSON format. A sample of the default \"normal\" format\nlooks like this\n\n```json\n [{\"id\":1,\"name\":\"marry\"},{\"id\":2,\"name\":\"bob\"}]\n```\n\nwhile it looks like below when in the \"compact\" format\n\n```json\n [[\"id\",\"name\"],[1,\"marry\"],[2,\"bob\"]]\n```\n\nthat is, the first row holds the column name list.\n\n[Back to TOC](#table-of-contents)\n\nrds_json_root\n-------------\n**syntax:** *rds_json_root \u0026lt;key\u0026gt;*\n\n**default:** *no*\n\n**context:** *http, server, location, if location*\n\nSpecifies the \"root\" key for data rows (if any). For example,\n\n```nginx\n rds_json on;\n rds_json_root rows;\n```\n\nwill return JSON output like this:\n\n```json\n {\"rows\":[{\"id\":2,\"name\":null},{\"id\":3,\"name\":\"bob\"}]}\n```\n\nif `rds_json_format compact` is also specified, then the\noutput will look like this:\n\n```json\n {\"rows\":[[\"id\",\"name\"],[2,null],[3,\"bob\"]]}\n```\n\nNginx variables are not supported in the \u003ckey\u003e argument of\nthis directive.\n\nIf this directive is not defined, neither are [rds_json_success_property](#rds_json_success_property),\nnor [rds_json_user_property](#rds_json_user_property), the JSON output for select queries will\njust be an array at the top level.\n\nWhen either [rds_json_success_property](#rds_json_success_property) or [rds_json_user_property](#rds_json_user_property) are specified,\nthis directive takes a default argument of \"data\".\n\n[Back to TOC](#table-of-contents)\n\nrds_json_success_property\n-------------------------\n**syntax:** *rds_json_success_property \u0026lt;key\u0026gt;*\n\n**default:** *no*\n\n**context:** *http, server, location, if location*\n\nSpecifies the top-level object property name used in the JSON output\nfor indicating success or false of the query.\n\n[Back to TOC](#table-of-contents)\n\nrds_json_user_property\n-----------------------\n**syntax:** *rds_json_user_property \u0026lt;key\u0026gt; \u0026lt;value\u0026gt;*\n\n**default:** *no*\n\n**context:** *http, server, location, if location*\n\nSpecifies additonal user properties for the top-level object\nof the JSON output.\n\nMultiple instances of this directives are allowed in a single scope.\n\nNginx variables are supported in the `value` argument.\n\nBoth of the `key` and `value` arguments will be automatically\nquoted according to JSON strings' notation.\n\n[Back to TOC](#table-of-contents)\n\nrds_json_errcode_key\n---------------------\n**syntax:** *rds_json_errcode_key \u0026lt;key\u0026gt;*\n\n**default:** *rds_json_errcode_key errcode*\n\n**context:** *http, server, location, if location*\n\nSpecifies the errcode key name used in the JSON output.\n\n[Back to TOC](#table-of-contents)\n\nrds_json_errstr_key\n-------------------\n**syntax:** *rds_json_errstr_key \u0026lt;key\u0026gt;*\n\n**default:** *rds_json_errstr_key errstr*\n\n**context:** *http, server, location, if location*\n\nSpecifies the errstr key name used in the JSON output.\n\n[Back to TOC](#table-of-contents)\n\nrds_json_ret\n------------\n**syntax:** *rds_json_ret \u0026lt;error-code\u0026gt; \u0026lt;descrption\u0026gt;*\n\n**default:** *no*\n\n**context:** *location, if location*\n\nThis directive enables a content handler that simply emits\nan response body like this:\n\n```json\n {\"errcode\":\u003cerror-code\u003e,\"errstr\":\"\u003cdescription\u003e\"}\n```\n\nwhile the `\u003cdescription\u003e` string will be properly quoted as\na JSON string.\n\n[Back to TOC](#table-of-contents)\n\nrds_json_content_type\n---------------------\n**syntax:** *rds_json_content_type \u0026lt;mime-type\u0026gt;*\n\n**default:** *rds_json_content_type application/json*\n\n**context:** *http, server, location, if location*\n\nControls the `Content-Type` header of the response generated by\nthis module's output filter.\n\n[Back to TOC](#table-of-contents)\n\nInstallation\n============\n\nYou're recommended to install this module (as well as the Nginx core and many other goodies) via the [OpenResty bundle](http://openresty.org). See [the detailed instructions](http://openresty.org/#Installation) for downloading and installing OpenResty into your system. This is the easiest and most safe way to set things up.\n\nAlternatively, you can install this module manually with the Nginx source:\n\nGrab the nginx source code from [nginx.org](http://nginx.org/), for example,\nthe version 1.13.6 (see [nginx compatibility](#compatibility)), and then build the source with this module:\n\n```bash\n\n $ wget 'http://nginx.org/download/nginx-1.13.6.tar.gz'\n $ tar -xzvf nginx-1.13.6.tar.gz\n $ cd nginx-1.13.6/\n\n # Here we assume you would install you nginx under /opt/nginx/.\n $ ./configure --prefix=/opt/nginx \\\n     --add-module=/path/to/rds-json-nginx-module\n\n $ make -j2\n $ make install\n```\n\nDownload the latest version of the release tarball of this module from [rds-json-nginx-module file list](https://github.com/openresty/rds-json-nginx-module/tags).\n\nStarting from NGINX 1.9.11, you can also compile this module as a dynamic module, by using the `--add-dynamic-module=PATH` option\ninstead of `--add-module=PATH` on the `./configure` command line above.\nAnd then you can explicitly load the module in your `nginx.conf` via the [load_module](http://nginx.org/en/docs/ngx_core_module.html#load_module) directive, for example,\n\n```nginx\nload_module /path/to/modules/ngx_http_rds_json_filter_module.so;\n```\n\nAlso, this module is included and enabled by default in the [OpenResty bundle](http://openresty.org).\n\n[Back to TOC](#table-of-contents)\n\nCompatibility\n=============\nThe following versions of Nginx should work with this module:\n\n* **1.13.x** (last tested: 1.13.6)\n* **1.12.x**\n* **1.11.x** (last tested: 1.11.2)\n* **1.10.x**\n* **1.9.x** (last tested: 1.9.7)\n* **1.8.x**\n* **1.7.x** (last tested: 1.7.10)\n* **1.6.x**\n* **1.5.x** (last tested: 1.5.12)\n* **1.4.x** (last tested: 1.4.4)\n* **1.2.x** (last tested: 1.2.9)\n* **1.1.x** (last tested: 1.1.5)\n* **1.0.x** (last tested: 1.0.9)\n* **0.9.x** (last tested: 0.9.4)\n* **0.8.x** (last tested: 0.8.55)\n* **0.7.x \u003e= 0.7.46** (last tested: 0.7.68)\n\nEarlier versions of Nginx like 0.6.x and 0.5.x will *not* work.\n\nIf you find that any particular version of Nginx above 0.7.44 does not\nwork with this module, please consider reporting a bug.\n\n[Back to TOC](#table-of-contents)\n\nAuthor\n======\nYichun \"agentzh\" Zhang (章亦春) *\u0026lt;agentzh@gmail.com\u0026gt;*, OpenResty Inc.\n\n[Back to TOC](#table-of-contents)\n\nCopyright \u0026 License\n===================\n\nThis module is licenced under the BSD license.\n\nCopyright (C) 2009-2017, Yichun Zhang (agentzh) \u0026lt;agentzh@gmail.com\u0026gt;, OpenResty Inc.\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n* Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n* Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\nTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n[Back to TOC](#table-of-contents)\n\nSee Also\n========\n\n* [ngx_drizzle](https://github.com/openresty/drizzle-nginx-module)\n* [ngx_postgres](https://github.com/FRiCKLE/ngx_postgres/)\n* [ngx_rds_csv](https://github.com/openresty/rds-csv-nginx-module)\n\n[Back to TOC](#table-of-contents)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenresty%2Frds-json-nginx-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenresty%2Frds-json-nginx-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenresty%2Frds-json-nginx-module/lists"}