Skip to content

How to convert below code in magento2 standard way

what is equivalent in m2.If we want to convert below code in magento2 which class we can use to send json response directly from helper class.

Mage::app()->getResponse()->clearHeaders()
                    ->setHeader('Content-Type','application/json')
                    ->setBody($jsonContent)->sendResponse();                   
                    exit;