Reputation: 8663
let email = MUser.sharedInstance.getUserEmail()
let json = [
"listIds": [""],
"contacts": [{ "email" : "\(email)" }]
];
I'm getting the error Consecutive statements on a line must be separated by ';'
when running the code above. What am I doing wrong?
Upvotes: 0
Views: 1812
Reputation: 3439
The problem is the dictionary email: email
where {
, }
are not recognised keywords You can define your json like this :
let json = [
"""
"listIds": [""],
"contacts": [ {"email" : "\(email)" }]
"""
];
or if you prefer to construct your dictionary in contacts with code, you could do something like below:
let json = [
"listIds": [""],
"contacts": [[ "email" : "\(email)" ]]
];
Upvotes: 2