protected function detectInvalidJsonFields()
    {
        if (json_encode($this->postFields) === false) {
            $invalidFields = array();
            foreach ($this->postFields as $key => $value) {
                if (json_encode($value) === false) {
                    $invalidFields[] = $key;
                }
            }
            throw new EntityException('Invalid data found in field(s): ' . implode(', ', $invalidFields), EntityException::INVALID_FIELDS);
        }
    }