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

'\x00' is the null character, which is illegal in JsonTools. #85

Open
alexander-dream opened this issue Nov 28, 2024 · 6 comments
Open
Labels
bug Something isn't working probably fixed? the issue/feature appears to be fixed/implemented, but there still may be issues

Comments

@alexander-dream
Copy link

The following JSON cannot be pretty-printed:

{"my_key_name":"Test\u0000"}

It can be formatted in JSONViewer: https://github.com/NPP-JSONViewer/JSON-Viewer

I verified it in the following website: https://jsonformatter.curiousconcept.com/#
image

@molsonkiko
Copy link
Owner

@alexander-dream
I made a conscious decision when designing JsonTools to not allow parsing of \x00 or \u0000 because JsonTools can't output literal NUL characters into Notepad++ due to strings that JsonTools sends to Notepad++ being treated as NUL-terminated C-strings. So this is not a bug per se but an implementation decision on my part.

However, I've decided that this was not a good decision, and I plan to fix this issue this weekend. Because JsonTools formats NUL characters as \u0000 and not a literal NUL character, the aforementioned limitation doesn't matter, and I was wrong to have this restriction. I'll let you know when I commit my fix, so that you can test it.

@molsonkiko molsonkiko added the bug Something isn't working label Nov 29, 2024
@molsonkiko
Copy link
Owner

@alexander-dream
I believe this issue is fixed by this commit. If you want to test out this commit, follow these instructions for downloading unreleased versions.

As noted in the commit message for that commit, JsonTools has a number of issues surrounding NUL characters that I am completely incapable of resolving, because they are rooted in the fundamental ways that it interfaces with Notepad++. That said, almost all of the JsonTools plugin commands from that commit onward should correctly handle your JSON containing \x00 or \u0000.

@molsonkiko molsonkiko added the probably fixed? the issue/feature appears to be fixed/implemented, but there still may be issues label Nov 30, 2024
@alexander-dream
Copy link
Author

Thanks man. That was fast. I'll check it out in 2 days when I get back to work. I think your extension is better than JsonViewer thanks to so many features. Well done.

@alexander-dream
Copy link
Author

Looks like the fix works for my use case. Thanks!

@molsonkiko
Copy link
Owner

@alexander-dream

Glad I could help! As usual, I'll close this issue shortly after the first release with the fix incorporated is available via the Plugins Admin.

@molsonkiko
Copy link
Owner

molsonkiko commented Dec 22, 2024

JsonTools v8.3.1 is the first official release with this fix implemented. Once a version of Notepad++ (hopefully 8.7.5 or 8.7.6) with a plugin list that includes JsonTools v8.3.1 is live for about a week with no reports of a recurrence, I'll close this issue.

NOTE: This comment previously recommended upgrading to v8.3, but v8.3.1 fixes an easily replicated crash bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working probably fixed? the issue/feature appears to be fixed/implemented, but there still may be issues
Projects
None yet
Development

No branches or pull requests

2 participants