How to get the Quote Id from Masked Quote Id (QuoteIdMask) in magento 2

I got the solution to get the original quote id from Masked Quote id by injecting the Magento\Quote\Model\QuoteIdMaskFactory in my controller.

public function execute()
    {

        $data = $this->_jsonHelper->jsonDecode($this->getRequest()->getContent());

        $quoteId = $data['quoteId'];
        $couponCode = $data['couponCode'];
  $quoteIdMask = $this->quoteIdMaskFactory->create()->load($quoteId, 'masked_id');
            $id = $quoteIdMask->getQuoteId();
echo $id;

}