<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>json on John Hooks</title>
    <link>https://badlyenginee.red/tags/json/</link>
    <description>Recent content in json on John Hooks</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Sun, 19 Feb 2023 12:04:13 -0500</lastBuildDate><atom:link href="https://badlyenginee.red/tags/json/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Custom JSON Marshaling in Go</title>
      <link>https://badlyenginee.red/posts/2023-02-19-json-marshaling/</link>
      <pubDate>Sun, 19 Feb 2023 12:04:13 -0500</pubDate>
      
      <guid>https://badlyenginee.red/posts/2023-02-19-json-marshaling/</guid>
      <description>Go&amp;rsquo;s standard library has a convenient way of handling JSON verification and default values through the Marshaler and Unmarshaler interfaces. This means we don&amp;rsquo;t necessarily need separate methods to handle this data verification/manipulation.
Unmarshaler Let&amp;rsquo;s pretend our system can&amp;rsquo;t allow users that are under the age 13 and we need a default timezone.
var ( ErrTooYoung = fmt.Errorf(&amp;#34;too young&amp;#34;) ErrTZNotFound = fmt.Errorf(&amp;#34;invalid timezone, must be one of %v&amp;#34;, timezones) ) type TimeZone string var timezones = [.</description>
    </item>
    
  </channel>
</rss>
