haskell / haskell/aeson

Better error message when parsing data with BOM

Open
#1,082 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1.3k
Forks
336
Avg merge
3d 7h
Merged PRs (30d)
4

Description

If an input bytestring starts with a BOM, `aeson` will fail to parse it as JSON with the error message "Error in $: Failed reading: not a valid json value". Rejecting the input is correct per the spec, and as discussed in #389 it is better for the application to remove the BOM before parsing if needed, rather than having `aeson` do it automatically.

However, it would be nice if the error message was more explicit about the cause of the problem. At least that would have saved me a bit of confusion when I couldn't get `aeson` to parse a JSON file that looked perfectly fine in my editor. :-)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.