title: Swift: how to create the actual JSON for the body in a post request
body: <p>I am having trouble figuring out how to construct this JSON structure in swift. I tried playing around with dictionaries and arrays and looking over StackOverflow for similar questions, but they have not solved my problem.</p>
  
  <pre><code>    {
    "requests": [
      {
        "image": {
          "content": "/9j/7QBEUGhvdG9zaG9...base64-encoded-image-content...fXNWzvDEeYxxxzj/Coa6Bax//Z"
        },
        "features": [
          {
            "type": "TEXT_DETECTION"
          }
        ]
      }
    ]
  }
  </code></pre>
  
  <p>Tried something like this: </p>
  
  <pre><code>let request = [["image":["content":"base64endocedString"]],
                     ["type":"TEXT_DETECTION"]]
  
      let dictionary : [String : Any] = [
          "requests":request
      ] 
  </code></pre>
  
  <p>with the output of this: </p>
  
  <pre><code>[
    "requests": [
      [
        "image": [
          "content": "base64endocedString"
        ]
      ],
      [
        "type": "TEXT_DETECTION"
      ]
    ]
  ]
  </code></pre>