public function buildBodyJson($contents)
    {
        $this->contextDataType   = self::CONTENT_TYPE_JSON;
        $this->contextDataExists = (bool) (strlen($contents) > 0);
        $this->contextDataValue  = json_decode($contents, false);

        if (json_last_error() !== JSON_ERROR_NONE) {
            $this->contextDataEmpty = true;
            $this->contextDataValue = null;
            if (function_exists('json_last_error_msg')) {
                $this->contextDecodeError = array(array('code' => json_last_error(), 'message' => json_last_error_msg()));
            }
            else {
                $this->contextDecodeError = array(array('code' => json_last_error(), 'message' => null));
            }
        }
        else {
            $this->checkDataIsEmpty();
        }
    }