We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

getJosnRawBody return type comfused

post with invalid json string

POST https://buluo-api.local/test
Content-Type: application/json
{"id":"1", "name":"koogua", aa}

$json = $this->request->getJsonRawBody(); // return null

     * Gets decoded JSON HTTP raw request body
     * @param bool $associative 
     * @return array|bool|\stdClass 
    public function getJsonRawBody($associative = false) {}

the class api return types: array|bool|\stdClass

What did you expect? This is normal behaviour. Your input json string is invalid. Phalcon internally uses PHP's json_decode , in this case it will fail to parse such invalid JSON string and you'll get null as a result i.e. nothing, since JSON is not valid.