I have two arrays :
let value = [41, 42, 45] ...
let date = [NSDate1, NSDate2, NSDate3] ...
I need to save the data as a json object onto our mongodb on the server. I tested with a sample object formatted as below and it worked as expected. How can I reformat my arrays into this format efficiently in swift/objective c?
let jsonObject = [
["date" : "2014/01/01", "value" : "41"],
["date" : "2014/01/02", "value" : "42"],
["date" : "2014/01/03", "value" : "45"]]
Any help would be very much appreciated ! Thank you !
Aucun commentaire:
Enregistrer un commentaire