-1

I need to send this JSON with HTTP post request, but I Want to convert him to a String, I have problem with the " " if somebody can do it for me or explain it for me it will help me, thank you!

{
  "inputs": [
    {
      "data": {
        "image": {
          "url": "https://someImage.jpg"
        }
      }
    }
  ]
}
Bar Kozlovski
  • 49
  • 1
  • 9

2 Answers2

0

You can try

let str :[String:Any] =  [
    "inputs": [
    [
    "data": [
    "image": [
    "url": "https://someImage.jpg"
    ]
    ]
    ]
]]
Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87
0

To make it dynamic use following approach:

let url = [
    "url": "https://someImage.jpg"
]

let data = [
    "image":url
]

let inputs = [
    "data": [data]
]
Bhavik Modi
  • 1,517
  • 14
  • 29