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

json: cannot unmarshal number #7

Closed
airgradienthq opened this issue Oct 9, 2023 · 3 comments
Closed

json: cannot unmarshal number #7

airgradienthq opened this issue Oct 9, 2023 · 3 comments

Comments

@airgradienthq
Copy link

After compiling and running I get this error:

{"time":"2023-10-09T08:30:40.102418+07:00","level":"ERROR","msg":"Parsing JSON payload","error":"json: cannot unmarshal number 53.5 into Go struct field .rhum of type int"}

@ljagiello
Copy link
Owner

Oh, interesting. I guess I incorrectly assumed that under "Measure" (https://api.airgradient.com/public/docs/api/v1/#/), number equals int. I will check this later today.

ljagiello added a commit that referenced this issue Oct 10, 2023
## Issue:
* #7

## Changes
* Replace int with float64
* Replace sweat drop emoji with droplet emoji
* Update screenshot
* Move fetch/unmarshal to dedicated function
* Add tests for Unmarshal API payloads

## TODO
- [x] Add test cases for different payloads
@ljagiello
Copy link
Owner

ljagiello commented Oct 10, 2023

@airgradienthq this issue should be fixed now with 4573904

Please confirm and I will close it.

@airgradienthq
Copy link
Author

Yes it works now.
image

Thanks!

This issue was closed.
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