JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • JSON ↔ Go type mapping: struct, []T

    Go SELF
    45 level,0 lecture
    We will break down a practical “mapping guide” between JSON and Go types: why JSON becomes a contract, how the encoding/json package decodes an object into a struct, an array into []T, and an unknown schema into map[string]any. We will also discuss exported fields, why you must pass an address to json.Unmarshal, the nuance with numbers (often float64 inside any), and the rules for choosing between strict typing and flexibility.
    Open
  • Marshal/Unmarshal, struct tags, and omitempty

    Go SELF
    45 level,1 lecture
    We break down how the encoding/json package encodes Go structs to JSON and back: what’s the difference between json.Marshal and json.Unmarshal, why decoding needs &, how struct tags ( json tags) work, what omitempty does (and what it does not do), which values are considered “empty”, and how to print “human-readable” JSON with json.MarshalIndent without losing parsing error context.
    Open
  • time.Time in JSON: format and compatibility

    Go SELF
    45 level,2 lecture
    We break down how the encoding/json package serializes time.Time by default (an RFC3339 string), why for contracts you almost always should pin UTC, how to correctly model optional dates via *time.Time and the omitempty tag, and also how to diagnose Unmarshal errors when dates are “crooked” and JSON is broken.
    Open
  • Validation after Unmarshal: required fields

    Go SELF
    45 level,3 lecture
    We break down why json.Unmarshal checks only the format and basic types, but not the meaning of the data, and how to build the discipline of decode → normalize → validate. We’ll talk about required fields and zero values, when it makes sense to use pointers (for example, * int), how to write Validate() with early returns or via errors.Join, how to diagnose broken JSON using errors.As and *json.SyntaxError, and why omitempty does not make a field “optional”.
    Open
  • DTO vs domain — when to store “as is”

    Go SELF
    45 level,4 lecture
    We break down the responsibility boundaries between DTO (contract/JSON) and the domain model: when a single struct is enough and when it’s better to separate them. Using a practical task example, we show the pipeline json.Unmarshal → Validate() → ToDomain() → FromDomain() → json.Marshal, discuss types like time.Time, and the nuances of omitempty.
    Open
Learn
  • Registration
  • Java course
  • Help with tasks
  • Pricing
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Activities
Company
  • About us
  • Contacts
  • Reviews
  • FAQ
  • Support
JavaRushJavaRush — is an interactive online course for learning Java programming from scratch. It contains 1200 practical tasks with one-click solution checking, the necessary minimum of theory on Java basics, and motivating features that help you complete the course: games, quizzes, interesting projects and articles on effective learning and the career of a Java developer.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush
MastercardVisa
"Programmers are not born" © 2026 JavaRush