Monday, 14 March 2016

Pretty JSON print of a CouchDB document

Using Python:
$ curl --silent --insecure https://user:'password'@couchdb-server:5984/database/document | python -m json.tool
Using Ruby:
$ gem install json
$ curl --silent --insecure https://user:'password'@couchdb-server:5984/database/document | ruby -rjson -n -e 'str=JSON.parse $_ ;puts JSON.pretty_generate(str)'

$ curl --silent --insecure https://user:'password'@couchdb-server:5984/database/document | ruby -n -e 'require "json" ; str=JSON.parse $_ ;puts JSON.pretty_generate(str)'

No comments:

Post a Comment