How to get JSON output from Cloudant CouchDB?

I'm new to cloudant and still figuring out various APIs that it provides for access and retrieval.

So far, I've used findbyIndex using selector string which returns JSON as de-serialised object of the POJO supplied.

For a certain use case which I'm working- I need to get JSON only and not the de-seralised object. Is there any way or API from which I can get the actual cloudant doc as JSON only ?

Answers


If you know the ID of the document you want to read only the raw JSON, you can use the find method to get the raw inputstream from the request. Currently using the findByIndex method you can only get a deserialised java object back, so you could always use a Map object for your POJO. Although that being said it might be possible to pass the type String for the class to deserialise, however I have not tested this.


Need Your Help

Is the returned proxy object of 'Proxy.newProxyInstance()' thread safe in java?

java proxy thread-safety jedis

I'm created a proxy class for Jedis, then it can return resource to the pool and mark the broken resource automatically.

CakePHP sub query SQL in HABTM relation

mysql cakephp subquery has-and-belongs-to-many cakephp-appmodel

I want to suggest related products by tags and sort order by the most matched.