title: Detect if JSON file has field
body: <p>My app reads settings from a config file:</p>
  
  <pre><code>file, _ := os.Open("config.json")
  config := config.Config{}
  err := json.NewDecoder(file).Decode(&amp;config)
  if err != nil {
      //handle err
  }
  </code></pre>
  
  <p>My JSON config file looks something like this:</p>
  
  <pre><code>{
      "site" : {
          "url" : "https://example.com"
      },
      "email" : {
          "key" : "abcde"
      }
  }
  </code></pre>
  
  <p>My structs are:</p>
  
  <pre><code>type Site struct {
      Url  string
  }
  
  type Email struct {
      Key  string
  }
  
  type Config struct {
      Site   Site
      Email  Email
  }
  </code></pre>
  
  <p>I would like the option of removing the <code>email</code> field from the JSON file to indicate that no email account will be used so:</p>
  
  <pre><code>{
      "site" : {
          "url" : "https://example.com"
      }
  }
  </code></pre>
  
  <p>How do I detect if a specific field exists in the JSON file in Go so something on the lines of:</p>
  
  <pre><code>if (Email field found in JSON file) {
      output "You want to receive emails"
  } else {
      output "No emails for you!"
  }
  </code></pre>