私は配列内にデータを挿入すると3つの配列を持ちます。そのデータは配列(キー、値のペア)にも追加されます。ios swiftでjsonオブジェクトを作成する方法
var person = ["ABC","XYZ","PQR"]
var email = ["[email protected]","[email protected]","[email protected]"]
var mobile = ["1234567890","1234567890","1234567890"]
私の問題は、JSONオブジェクトとデータストアのキー値のペアを作成する方法です。
私は人からJSON配列を生成するこの
{
"blogs": [
{
"person": "ABC",
"email": "[email protected]",
"contact": "1234567890"
},
{
"person": "XYZ",
"email": "[email protected]",
"contact": "1234567890"
},
{
"person": "PQR",
"email": "[email protected]",
"contact": "1234567890"
}
]
}
ようにデータが配列にデータを追加するアクションボタンでurl()
に渡し、テーブル
@IBAction func meeting_info(_ sender: Any) {
var PersonName = person_name.text
var Email = email_id.text
var MobileNo = mobile_no.text
if (person_name.text?.isEmpty)! || (email_id.text?.isEmpty)! || (mobile_no.text?.isEmpty)! {
displayMyAlertMessage(userMessage: "please check field empty or not");
}
else{
person.append(person_name.text!)
email.append(email_id.text!)
mobile.append(mobile_no.text!)
meetingTableView.reloadData()
}
}
たい、電子メールと連絡先のキーバリューのペア
私は –
のvar SSSのように1 paramerterであなたの値を渡す= [ "cutomer名": "XYZ"、 "日付": "13-08-2017"、 "blogs":array]を[String:Any]とし、jsonobjectにカバレッジを入れ、jsonobjectがWebサービスを投稿するために渡します。 –