Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Character "#" inside quotes is interpreted as comment #22

Closed
zikalino opened this issue Jun 26, 2019 · 2 comments
Closed

Character "#" inside quotes is interpreted as comment #22

zikalino opened this issue Jun 26, 2019 · 2 comments

Comments

@zikalino
Copy link

commentjson.loads('{ "aaa": "bb#b" }')

or

commentjson.loads('{ "aaa": "b//bb" }')

causes a crash:

Exception thrown by JSON library (json): �[4;37mUnterminated string starting at�[0m

    Traceback (most recent call last):
      File "c:\dev\azure-cli-dev-tools\env\lib\site-packages\commentjson\commentjson.py", line 87, in loads
        return json.loads('\n'.join(lines), **kwargs)
      File "C:\Users\zikalino\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 348, in loads
        return _default_decoder.decode(s)
      File "C:\Users\zikalino\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "C:\Users\zikalino\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 353, in raw_decode
        obj, end = self.scan_once(s, idx)
    json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 10 (char 9)

and this can happen for example in case of Azure ARM Templates, like here:

https://github.com/opencb/opencga/blob/0d4c942d71894a16aa30b498ecb2c77318449cd8/opencga-app/app/scripts/azure/arm/daemonvm/azuredeploy.jsonc#L219

@vaidik
Copy link
Owner

vaidik commented Jun 29, 2019

Yeah there are a lot of bugs like that one in the library right now. It was sort of hacked together for some personal use.

Seeing some interest in this, I am working on fixing these bugs. Watch this space out for updates.

@vaidik vaidik mentioned this issue Jul 7, 2019
@vaidik
Copy link
Owner

vaidik commented Jul 7, 2019

This is fixed. You can try the latest version of commentjson which addresses this and a lot of other unhandled cases like this.

@vaidik vaidik closed this as completed Jul 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants