JSON format by get


#1

When I do a query like:

$res = $myBucket->get('DocumentName');

If the output response using

print_r($res);

or

echo json_encode($res);

In response, I get no JSOn format.
The question is how to get the answer in the JSON format


#2

Hey Kozlov,

The CouchbaseBucket methods all return Document objects. If you wish to access the value of the document as JSON, try something like:

$res = $myBucket->get('DocumentName');
echo json_encode($res->value);

Cheers, Brett