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

gason doesn't parse comments #6

Open
ChrisJefferson opened this issue Jun 6, 2014 · 2 comments
Open

gason doesn't parse comments #6

ChrisJefferson opened this issue Jun 6, 2014 · 2 comments

Comments

@ChrisJefferson
Copy link
Contributor

I realise that // and /* ... */ comments are both not part of JSON, but they commonly pop up. I feel it it fit's gason's aim to parse as best as possible to handle comments, and they would not hurt efficiency.

I am happy to knock up a patch for this, but wanted to check before I bothered if it would in principle be accepted. I would make no attempt at saving the comments or making them accessable, just skip straight on over them.

@vivkin
Copy link
Owner

vivkin commented Jun 8, 2014

I don't think this is a good idea. Comments are not supported in text editors, other parser and spec. With this extensions writing the simple pretty-print program turned into not a simple task at all.

@ChrisJefferson
Copy link
Contributor Author

I can understand not wanting to pretty print the comments -- I was suggesting throwing them away entirely.

For my current use, I have written a "strip comments" function I can call on a buffer, which removes comments before I parse the JSON (this function just replaces the comments with spaces, so the buffer becomes valid JSON).

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