koa-json
JSON pretty-printed response middleware. Also converts node object streams to binary.
Installation
$ npm install koa-json
Options
pretty
default to pretty response [true]param
optional query-string param for pretty responses [none]spaces
JSON spaces [2]
Example
Always pretty by default:
var json = ;var Koa = ;var app = ; app; app;
yields:
$ GET / "foo": "bar"
Default to being disabled (useful in production), but togglable via the query-string parameter:
var Koa = ;var app = ; app; app;
yields:
$ GET / "foo":"bar"
$ GET /?pretty "foo": "bar"
License
MIT