title: JSON format in Swift
body: <p>I want to change the JSON format like below in Swift code. Please help</p>
  
  <p>Currently having working code below,</p>
  
  <pre><code>let jsonDict = ["UserID": user_id, "UserName": user_name, "User No": user_AccNo, "UserAddress": user_AccAddress, "User Type": user_AccType] as [String : Any]
          let jsonData = try! JSONSerialization.data(withJSONObject: jsonDict, options: [])
  
          var request = URLRequest(url: url)
          request.httpMethod = "POST"
  
          request.setValue("application/vnd.kafka.json.v2+json", forHTTPHeaderField: "Content-Type")
          request.setValue("application/vnd.kafka.v2+json", forHTTPHeaderField: "Accept")
  
          request.httpBody = jsonData
  </code></pre>
  
  <p>I want to change this code to input the following format JSON data: </p>
  
  <pre><code>'{"records":[{"value":{"UserID":"user_id"}}]}'
  </code></pre>
  
  <p>To apply for below POST request programmatically,</p>
  
  <pre><code>$ curl -X POST -H "Content-Type: application/vnd.kafka.json.v2+json" \
        -H "Accept: application/vnd.kafka.v2+json" \
        --data '{"records":[{"value":{"foo":"bar"}}]}' "http://localhost:8082/topics/jsontest"
  </code></pre>
  
  <p>Please advise me how to format the JSON to fit this format in Swift: </p>
  
  <pre><code>{"records":[{"value":{"UserID":"user_id"}}]}
  </code></pre>