/**
  * @return \Magento\Framework\Controller\Result\Json
  */
 public function execute()
 {
     $response = new DataObject();
     $id = $this->getRequest()->getParam('id');
     if (intval($id) > 0) {
         $product = $this->productRepository->getById($id);
         $response->setId($id);
         $response->addData($product->getData());
         $response->setError(0);
     } else {
         $response->setError(1);
         $response->setMessage(__('We can\'t retrieve the product ID.'));
     }
     /** @var \Magento\Framework\Controller\Result\Json $resultJson */
     $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
     $resultJson->setData($response->toArray());
     return $resultJson;
 }