I am new to the development of applications for IOS and I am using swift, I need to generate a Json array like this:
{
"PaymentItems": [
{
"id": "1",
"paid": false
},
{
"id": "2",
"paid": false
},
{
"id": "3",
"paid": false
}
]
}
to achieve the above mentioned I am using this block of code, so far without success.
var elementos = [AnyObject]()
for item in transacciones_modificacion
{
let jsonObjectPaid: [AnyObject] = [[ "id": item.Id, "paid": item.Paid]]
elementos.append(jsonObjectPaid)
}
let pagosArray = ["PaymentItems": [elementos]]
in an arrangement like this: