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

Accept JSONC by stripping it of it's comments #227

Merged
merged 2 commits into from
Oct 5, 2022
Merged

Accept JSONC by stripping it of it's comments #227

merged 2 commits into from
Oct 5, 2022

Conversation

VladCuciureanu
Copy link
Contributor

Implements #145 ... Kind of.

This implementation strips JSONC, therefore converting it to plain JSON.
It does that by using Microsoft's 'jsonc-parser' package.

Inputting any JSONC data will result in the comments getting stripped and the user being greeted by a warning toast notification.

Screenshot 2022-10-04 at 23 45 41

@jpollard-cs
Copy link

jpollard-cs commented Oct 5, 2022

Thanks for tackling this! Why not approach this in the parser logic by replacing calls to JSON.parse with the jsonc-parser parse method, but just ignore adding comments to the visualization for now? Is the interface incompatible?

@VladCuciureanu
Copy link
Contributor Author

Thanks for tackling this! Why not approach this in the parser logic by replacing calls to JSON.parse with the jsonc-parser parse method, but just ignore adding comments to the visualisation for now? Is the interface incompatible?

The interface is indeed compatible. I actually replaced JSON.parse calls to jsonc-parser's parser but I didn't want to add any unneeded complexity that might be brought by a more complex parser. Do you prefer I switch over to using the parser instead?

@jpollard-cs
Copy link

Thanks for tackling this! Why not approach this in the parser logic by replacing calls to JSON.parse with the jsonc-parser parse method, but just ignore adding comments to the visualisation for now? Is the interface incompatible?

The interface is indeed compatible. I actually replaced JSON.parse calls to jsonc-parser's parser but I didn't want to add any unneeded complexity that might be brought by a more complex parser. Do you prefer I switch over to using the parser instead?

cc @AykutSarac

@VladCuciureanu
Copy link
Contributor Author

Thanks for tackling this! Why not approach this in the parser logic by replacing calls to JSON.parse with the jsonc-parser parse method, but just ignore adding comments to the visualisation for now? Is the interface incompatible?

The interface is indeed compatible. I actually replaced JSON.parse calls to jsonc-parser's parser but I didn't want to add any unneeded complexity that might be brought by a more complex parser. Do you prefer I switch over to using the parser instead?

cc @AykutSarac

Whoops. Confused you with @AykutSarac 😅 The question still stands @AykutSarac 🧐

@AykutSarac AykutSarac linked an issue Oct 5, 2022 that may be closed by this pull request
@AykutSarac AykutSarac merged commit cde90e1 into AykutSarac:main Oct 5, 2022
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

Successfully merging this pull request may close these issues.

JSONC support
3 participants