JSON decoding - error message not enough information?

Hello everyone!

I’m writing a JSON decoder for a service I own. It’s currently failing, and I think this is a problem with the JSON returned from the server (not the decoder), but there is not enough details about where it fails:

image

I remember the error messages having a lot more details. Am I missing a configuration or flag?

Thanks for the help!

Are your trying to find your bug or are trying to improve your error message?

In both cases it will be helpful if you post your json and your decoder.

The 9th object from the JSON response doesn’t have the expected field “name”.

3 Likes

Looks like a good candidate for https://github.com/elm/error-message-catalog in case you used the json decoding from the standard library.

1 Like

Thanks everyone for the answers.

It was indeed something wrong with the JSON returned from the server. The decoder is a Decode.list decodeItem at the top-level, and the list returned was large, so I was having trouble finding where the name attribute was missing (the 9th element).

Yes, I’m using only functions from Json.Decode.

Thanks for the help!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.