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

File Bom header causes parsing failure #370

Open
Bolin-Sun opened this issue Oct 12, 2024 · 1 comment
Open

File Bom header causes parsing failure #370

Bolin-Sun opened this issue Oct 12, 2024 · 1 comment

Comments

@Bolin-Sun
Copy link

I have discovered an issue where requesting a JSON data return that includes a file BOM header will result in parsing failure

image
image

@pnikonowicz
Copy link

According to the documentation around Parse, it is recommended to invoke @valid to ensure that your json is in a correct format if you are uncertain. Given the following test case with a BOM, we can see the expected behavior occuring. In this case, a byte string with a BOM validates as false; which is intended.

stringWithBOM := append([]byte{0xEF, 0xBB, 0xBF}, []byte("{}")...)
assert(t, GetBytes(stringWithBOM, "@valid").Exists() == false)

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