pyhocon icon indicating copy to clipboard operation
pyhocon copied to clipboard

Empty string key not supported

Open yunjiangster opened this issue 4 years ago • 2 comments

I am using the latest pyhocon and it fails to parse the simplest json dictionary with empty string:

import pyhocon
from pyhocon import ConfigFactory
ConfigFactory.parse_string('{"": ""}')

Traceback (most recent call last): ... assert key_index < len(key_path), (key_index, key_path, self) AssertionError: (0, [], ConfigTree())

On the other hand, json handles it perfectly fine.

import json
json.loads('{"": ""}')

{'': ''}

Thanks for your attention. I am surprised this simple issue hasn't been raised before.

pip show pyhocon

Name: pyhocon Version: 0.3.57

python --version

Python 3.6.5

cat /etc/os-release

NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"

yunjiangster avatar May 04 '21 16:05 yunjiangster

Same issue

polopi avatar Oct 14 '21 22:10 polopi