AppliedGo / comments

Utteranc.es comments for appliedgo.net
Creative Commons Zero v1.0 Universal
0 stars 0 forks source link

json #13

Open christophberger opened 1 year ago

christophberger commented 1 year ago

Written on 02/25/2017 19:24:13

URL: https://appliedgo.net/json/

christophberger commented 1 year ago

Migrated comment, written by bulatenkom on 04/05/2017 15:39:48

Hello, Christoph! Thanks for the article.
There is some errata "Lon float32 `json: lat`", but should be "Lon float32 `json: lon`".
Would be great if you could fix it.

christophberger commented 1 year ago

Migrated comment, written by Christoph on 04/05/2017 19:06:53

Thanks, well spotted! Luckily, at least the code in the video is correct at this point!
I fixed the error in the article now.

christophberger commented 1 year ago

Migrated comment, written by Hei Li on 01/25/2019 13:10:57

you can send any json and this would still work. How would you prevent that?

christophberger commented 1 year ago

Migrated comment, written by Christoph on 01/25/2019 20:27:29

I do not see how sending any JSON will work. The server unmarshals the received JSON into a loc struct and errors out if the received JSON does not map to the loc type. Or is there something else that you want to prevent?

christophberger commented 1 year ago

Migrated comment, written by max2veg on 12/18/2019 17:24:53

"go get -d github.com/appliedgo/json.go" returns:

fatal: could not read Username for 'https://github.com': terminal prompts disabled
package github.com/appliedgo/json.go: exit status 128

christophberger commented 1 year ago

Migrated comment, written by max2veg on 12/18/2019 17:33:12

"go get -d github.com/appliedgo/json.go" returns:

fatal: could not read Username for 'https://github.com': terminal prompts disabled
package github.com/appliedgo/json.go: exit status 128

christophberger commented 1 year ago

Migrated comment, written by max2veg on 12/19/2019 20:31:01

How would one use JavaScript to send the data, instead of the GO client?

christophberger commented 1 year ago

Migrated comment, written by disqus_1OnwgTtzvV on 09/12/2020 19:51:50

// remove the ".go" at the end
go get -d github.com/appliedgo/json

christophberger commented 1 year ago

Migrated comment, written by Christoph on 09/18/2020 14:49:39

Fun fact: I received the email notification for your post just a few days ago, on Sep 12, 2020. Nine months for an email, not bad, Disqus!

Regarding your issue: This was an error of mine, apologies for that. The ".go" suffix is wrong and must be omitted from the go get command.
I fixed the article and also added a download instructions when using Go Modules.

christophberger commented 1 year ago

Migrated comment, written by Christoph on 09/18/2020 14:58:36

That's actually a question to the JavaScript experts. Plain Javascript usually has the XMLHttpRequest object available, as well as the Fetch API. However, I would guess that in most cases, some Javascript framework (VueJS, React, Bootstrap,...) is used that provides a framework-specific approach to calling REST API's.