title: Go "unexpected end of JSON input" error
body: <p>I know this has been asked a few times, but I don't see one that matches my need to support NULL values. I have fields that are optional in a DB. I need to output data in JSON format that includes these potentially NULL fields, which I would like to omit from the JSON if they are still NULL. I can change to some other default value other than NULL, but I haven't found one that works. I'm storing JSON arrays in JSON format (longtext) in MariaDB. Here's my code that fails (Playground <a href="https://play.golang.org/p/hLRh0d5D_CA" rel="nofollow noreferrer">link</a>):</p>
  
  <pre><code>package main
  
  import (
      "encoding/json"
      "fmt"
  )
  
  var respBytes = []byte("")
  // Example data [12345, 23456, 34567]
  
  func main() {
      var jsonData []interface{}
      err := json.Unmarshal(respBytes, &amp;jsonData)
      if err != nil {
          fmt.Println(err)
      }
      fmt.Println(jsonData)
  }
  </code></pre>
  
  <p>Replace <code>respBytes</code> empty string with example data and it works. Example data is simple JSON number array such as: "[12345, 23456, 34567]". How can I get it to work with data and without?</p>