Playlist ▶️: • Go Programming
In this video, we look at the utilities offered by Go to work with JSON data.
We'll look at how how to decode JSON data from an API into a Go struct, and we'll also see how to encode a struct to JSON data.
In the video, we'll cover some additional topics, such as the DisallowUnknownFields function, excluding struct fields from being encoded to JSON, and omitting empty values from the encoded JSON data.
☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
https://ko-fi.com/bugbytes
📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
01:24 Decoding JSON data into Go struct
11:43 DisallowUnknownFields() Decoder function
14:37 Private fields in a Go struct
16:40 Encoding a Go struct to JSON
20:24 Excluding struct fields from the encoded output
23:06 Omitting fields with empty values from the encoded output
Playlist ▶️:
• Go Programming
𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📖 Blog: https://bugbytes.io/posts/
👾 Github: https://github.com/bugbytes-io
🐦 Twitter: / bugbytesio
📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
encoding/json package: https://pkg.go.dev/encoding/json
JSON-Placeholder API: https://jsonplaceholder.typicode.com/...
#golang #webdevelopment #json
Watch video Go Programming - JSON Encoding & Decoding in Golang online without registration, duration hours minute second in high quality. This video was added by user BugBytes 17 July 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 11,364 once and liked it 439 people.