-
Notifications
You must be signed in to change notification settings - Fork 25
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
'//' in string still broken in version 0.6 #16
Comments
The fundamental problem is that this library tries to use regex to strip comments, which can't be done (at least, not in a way that will properly handle all cases). It needs a proper parser to do this. After this discovery, I've decided instead to handle the problem by making a simple system call to a better json comment stripping executable-- there are many available such as https://github.com/douglascrockford/JSMin or https://github.com/sindresorhus/strip-json-comments-- and which took 13 lines of python to replace commentjson |
Yeah you are right. The right way to do this would be to build a parser for the features that commentjson provides. I have not been able to find enough time to do it. For the solution that you have provided to get around this problem, that might just work if your need is to javascript style comments (if my understanding is correct). |
This is fixed. You can try the latest version of commentjson which addresses this and a lot of other unhandled cases like this. |
How to reproduce this bug:
commentjson.loads(commentjson.dumps('//'))
The text was updated successfully, but these errors were encountered: