I have following raw data to be sent as parameters while using alamofire in swift
{
"customer": {
"firstname": "test",
"lastname": "user",
"email": "testuser30@gmail.com",
"website_id": 1,
"addresses": [
{
"customer_id": 3292,
"region": {
"region": "New York"
},
"country_id": "US",
"street": [
"US"
],
"telephone": "84656313",
"postcode": "34521",
"city": "us",
"firstname": "test",
"lastname": "usr",
"default_shipping": true,
"default_billing": true
}
]
}
}
I have written the parameters as given below in the code using alamofire.
let customer : Parameters = [
"email":email,
"firstname":fname,
"lastname":lname,
"website_id":1,
"addresses": {
[
"customer_id": id,
"region": [
"region": state
],
"country_id": country,
"street": {
self.add1Txt.text! + self.add2Txt.text!
},
"telephone": self.phoneTxt.text!,
"postcode": self.pincodeTxt.text!,
"city": self.cityTxt.text!,
"firstname": self.fnameLbl.text!,
"lastname": self.lnameLbl.text!,
"default_shipping": true,
"default_billing": true
]
}
]
let parameters: Parameters =
[
"customer": customer
]
It shows 'Invalid type in JSON write (__SwiftValue)'. What is the issue with this parameter passing?