You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [1]: import json, pyhocon
In [2]: single = r'{"a": "b\.c"}'
In [3]: double = r'{"a": "b\\.c"}'
In [4]: json.loads(single)
---------------------------------------------------------------------------
JSONDecodeError...
In [5]: json.loads(double)
Out[5]: {'a': 'b\\.c'}
In [6]: pyhocon.ConfigFactory.parse_string(single)
Out[6]: ConfigTree([('a', 'b\\.c')])
In [7]: pyhocon.ConfigFactory.parse_string(double)
Out[7]: ConfigTree([('a', 'b\\\\.c')])
In [8]: json.dumps(json.loads(double))
Out[8]: '{"a": "b\\\\.c"}'
In [9]: json.dumps(json.loads(double)) == double
Out[9]: True
In [10]: json.dumps(pyhocon.ConfigFactory.parse_string(double))
Out[10]: '{"a": "b\\\\\\\\.c"}'
In [11]: json.dumps(pyhocon.ConfigFactory.parse_string(double)) == double
Out[11]: False
I looked at the HOCON documentation and I couldn't find explicit guidance, but I'd expect that my single example would be invalid HOCON (it's invalid JSON?) and that my double example would get parsed the same way that json.loads does it?
The text was updated successfully, but these errors were encountered:
I looked at the HOCON documentation and I couldn't find explicit guidance, but I'd expect that my
single
example would be invalid HOCON (it's invalid JSON?) and that mydouble
example would get parsed the same way thatjson.loads
does it?The text was updated successfully, but these errors were encountered: