Reading list Switch to dark mode

    How to get Json from the Magento JsonResultFactory Class

    Updated 5 January 2023

    <?php
    
    namespace Webkul\<Modulename>\Framework\Controller\Result;
    
    /**
     *  Inherited 
     * */
    class Json extends \Magento\Framework\Controller\Result\Json
    { 
        /**
         * GetJsonData function
         *
         * @return void
         */
        public function getJsonData()
        {
            return $this->json;
        }
    
        /**
         * GetData function
         *
         * @return void
         */
        public function getData()
        {
            return \Zend_Json::decode($this->json);
        }
    }

        <preference for="Magento\Framework\Controller\Result\Json" type="Webkul\PosMultiFee\Framework\Controller\Result\Json" />

    Start your headless eCommerce
    now.
    Find out More
    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home