*/ class Mage_Api2_Model_Request_Interpreter_Json implements Mage_Api2_Model_Request_Interpreter_Interface { /** * Parse Request body into array of params * * @param string $body Posted content from request * @return array|null Return NULL if content is invalid * @throws Exception|Mage_Api2_Exception */ public function interpret($body) { if (!is_string($body)) { throw new Exception(sprintf('Invalid data type "%s". String expected.', gettype($body))); } $decoded = Zend_Json::decode($body); if ($body != 'null' && $decoded === null) { throw new Mage_Api2_Exception('Decoding error.', Mage_Api2_Model_Server::HTTP_BAD_REQUEST); } return $decoded; } }