Consume a REST API in Go | Convert JSON to a Struct
Converting JSON to anything is a pretty common thing to do in any programming language, so in this video we are going to learn how to take JSON from a REST API and convert it into a usable data type in Go: a struct! We will use the encoding/json package found in the standard library.
We will consume 2 REST APIs, one will be a very simple one and then we will consume one that has embedded types that you might typically see.
Documentation for both APIs can be found here:
Cat Facts: https://catfact.ninja/
Random User: https://randomuser.me/
All code found in this video will be at: š» https://github.com/NerdCademyDev/golang
š¤ Let me know if you have any issues!
ā”ļø What else would you like me to cover?
š Always Keep Learning!
37570434 Bytes