subject_id=[{"program_id": "1","subject_id":"1"},{"program_id":%20"2","subject_id":"5"}]
I Want to make this type of json.
This is my code i am trying to change subject_id only but it prints whole array. how can i change it.
let subject_id = [String](arrayLiteral: "1","5")
let program_id = [String](arrayLiteral: "1","3")
for program_id in program_id
{
print(program_id)
}
let phoneNumbersDictionary = program_id.map({ ["program_id": $0 , "subject_id" : $0 ] })
let JSON = try? JSONSerialization.data(withJSONObject: phoneNumbersDictionary, options: [])
if let JSON1 = JSON
{
print(String(data: JSON1, encoding: String.Encoding.utf8)!)
}