title: Swift 4.1 Codable/Decodable Nested Array
body: <p>Need some help with more complicated json, with the newest swift4.1 encoder/decoder:</p>
  
  <p>struct:</p>
  
  <pre><code>struct LMSRequest: Decodable {
  let id : Int?
  let method : String?
  let params : [String]?
  enum CodingKeys: String, CodingKey {
      case id = "id"
      case method = "method"
      case params = "params"
  }
  init(from decoder: Decoder) throws {
      let values = try decoder.container(keyedBy: CodingKeys.self)
      id = try values.decodeIfPresent(Int.self, forKey: .id)
      method = try values.decodeIfPresent(String.self, forKey: .method)
      params = try values.decodeIfPresent([String].self, forKey: .params)
  }}
  </code></pre>
  
  <p>json:</p>
  
  <pre><code>let json = """
  {
    "id": 1,
    "method": "slim.request",
    "params": [
      "b8:27:eb:db:6d:62",
      [
        "serverstatus",
        "-",
        1,
        "tags:GPASIediqtymkovrfijnCYXRTIuwxNlasc"
      ]
    ]
  }
  """.data(using: .utf8)!
  </code></pre>
  
  <p>code:</p>
  
  <pre><code>let decoder = JSONDecoder()
  let lms = try decoder.decode(LMSRequest.self, from: json)
  print(lms)
  </code></pre>
  
  <p>Error is expected to decode string but found array instead. It's coming from the nested array within the "params" array... really stuck on how to build this out, Thanks!</p>