Found it. Had to use
echo json_encode($product->cast());
Question
I try to build a REST interface using the Fat Free Framework. I use the following code to query the database:
$product = new DB\SQL\Mapper($this->db, 'product');
$product->load(array('id=?', $this->productID));
I can now return for instance the title with
echo json_encode($product->title);
But how do I return the whole row? The following won't work
echo json_encode($product);
Solution
Found it. Had to use
echo json_encode($product->cast());