Go Programming - JSON Encoding & Decoding in Golang

preview_player
Показать описание

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:

📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
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 ▶️:

𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:

📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:

#golang #webdevelopment #json
Рекомендации по теме
Комментарии
Автор

Your videos are snappy, clearly delivered, and contain exactly the right amount of additional “extras” like the verbose way to do something and a succinct way to do it. Thank you very much for your quality videos!

lifeofdandotme
Автор

Great 😀. You kept your promise as you always do. Thanks very much for your educative gists.

AmoahDevLabs
Автор

dude thanks so much, you are the best go instructor here, please keep doing more videos on go!

khairulhaaziq
Автор

Great work! The video is very well structured. Appreciated.

alperari
Автор

wow go is an amazing language and so are your tutorials

krishnabharadwaj
Автор

It would be nice to see how to store todos in JSON to a NoSql database like clover. And then how to retrieve them.

lukinsify
Автор

to clarify: no, when your application exits without you having called defer body.close() you do not have a memory leak (because the application exited so the OS cleans up the resources).

Chris-jpll
Автор

I don't know Go, but always wonder: why not write "if err {" instead of "if err != nil {"
?

flipflap
welcome to shbcf.ru