Boldly Go
Blog YouTube Hire Me Contact Daily Email
Boldly Go
Blog YouTube Hire Me Contact Daily Email
JSON

6 min read


JSON Tricks: The Self-Referencing Marshaler

For more content like this, buy my in-progress eBook, Data Serialization in Go⁠, and get updates immediately as they are added! The content in this post is included in my in-progress eBook, Data Serialization in Go, available on LeanPub. I’ve done a lot of JSON handling in Go. In the process, I’ve learned a number of tricks to solve specific problems. But one pattern in particular I find myself repeating ad infinitum.

JSON

5 min read


JSON Tricks: Extending an Embedded Marshaler

How can you embed a struct with a custom MarshalJSON() method?

JSON

6 min read


JSON Tricks: JSON Arrays as Go Structs

How can you marshal and unmarshal JSON array as though it were a struct in Go?

How-Tos

5 min read


JSON Tricks: "Slightly" Custom Marshaling

For more content like this, buy my in-progress eBook, Data Serialization in Go⁠, and get updates immediately as they are added! Have you ever found yourself writing a custom JSON marshaler in Go, because you needed something only slightly different than what the standard JSON marshaler provides? Maybe the consumer of your JSON payload expects an array where you have a single item. Or maybe you need to nest your object one level deeper in your JSON than is used in your application.

My Content

  • Boldly Go: Daily
  • YouTube

My Services

  • Dev Subscription
  • Private Mentoring

About me

  • Contact Me
  • Privacy Policy

Subscribe to Boldly Go: Daily

Daily suggestions to improve your control of the Go language. I will respect your inbox, and honor my privacy policy.

Not convinced? Browse the archive.

© 2025 Jonathan Hall. All rights reserved.