Chapter 9
Encoding and Decoding Data Using JSON
IN THIS CHAPTER
Understanding JSON
Decoding JSON to the various data types in Go
Encoding JSON strings
JavaScript Object Notation (JSON) is a standard, text-based format for representing data using the JavaScript object syntax. It’s a lightweight and easy-to-parse data representation language, commonly used for communicating between web servers and clients.
In this chapter, I explain the basics of JSON and how you can manipulate JSON content in your Go applications.
Getting Acquainted with JSON
JSON is growing more and more popular these days. It’s commonly used in data representation, as well as data exchange. JSON is less verbose than XML, but that’s exactly what makes it so useful. JSON strings are shorter than their XML equivalents, and parsing JSON strings is a walk in the park.
In this section, I give you a brief walk-through of JSON. If you’re already super-familiar with JSON, you can skip directly to the “Decoding JSON ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
If you aren’t familiar with XML, check out the introduction to XML at