Monday, August 28, 2023
HomeiOS Developmentios - How can I take away Escaped string from Json?

ios – How can I take away Escaped string from Json?


I’m attempting to ship request to server. unable get appropriate format JSON . please assist to resolve this error.
[ “{“ProductGroupId”:”994475″,”ProductId”:”994408″}”, “{“ProductGroupId”:”994475″,”ProductId”:”999737″}”, “{“ProductGroupId”:”994475″,”ProductId”:”999915″}”, “{“ProductGroupId”:”994475″,”ProductId”:”1194875″}” ]

self.productGroupList = json.response.end result.packages[0].productGroups for index in 1..<self.productGroupList[3].merchandise.rely{
    self.productGroupIdList.append(self.productGroupList[3].merchandise[index].productGroupID) self.productGroupIdList.append(self.productGroupList[3].merchandise[index].id) let dictionary = ["ProductGroupId": self.productGroupList[3].merchandise[index].productGroupID, "ProductId": self.productGroupList[3].merchandise[index].id] as [String : Any] do {
        let jsonData:Information = strive JSONSerialization.information( withJSONObject: dictionary, choices: .fragmentsAllowed ) let jsonString = String(information: jsonData, encoding: .utf8)! self.Linelist.append(jsonString)
    }

    catch {
        print(error.localizedDescription)
    }

    self.noOfCycleValuesDropDown()
}
}
}
catch{
    print(error)
}
case .failure(let error): print("Error: (error.localizedDescription)") // Deal with the error if wanted
}
}
}

I’m Anticipating request like under format

[
  {
    "ProductGroupId": "994475",
    "ProductId": "994408"
  },
  {
    "ProductGroupId": "994475",
    "ProductId": "999737"
  },
  {
    "ProductGroupId": "994475",
    "ProductId": "999915"
  },
  {
    "ProductGroupId": "994475",
    "ProductId": "999951"
  },
  {
    "ProductGroupId": "994475",
    "ProductId": "1014043"
  },
  {
    "ProductGroupId": "994475",
    "ProductId": "1194891"
  }
]



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments