title: Convert string JSON response to a boolean using Swift 4 Decodable
body: <p>I'm refactoring some projects where I'd previously used third-party JSON parsers and I've encountered a goofy site that returns a boolean as a string.</p>
  
  <p>This is the relevant snippet from the JSON response:</p>
  
  <pre><code>{
      "delay": "false",
      /* a bunch of other keys*/
  }
  </code></pre>
  
  <p>My struct for Decoding looks like this:</p>
  
  <pre><code>struct MyJSONStruct: Decodable {
    let delay: Bool
    // the rest of the keys
  }
  </code></pre>
  
  <p>How would I convert the string returned in the JSON response into a Bool to match my struct in Swift 4? While <a href="http://benscheirman.com/2017/06/ultimate-guide-to-json-parsing-with-swift-4/" rel="nofollow noreferrer">this post</a> was helpful, I can't figure out how to turn a string response into a boolean value.</p>