我在一个订单中发送swiftyJSON JSON,然后在另一个订单中返回它

时间:2016-09-21 19:56:16

标签: ios json swift swifty-json

所以我发送

{"02052":"Medfield,MA","02054":"Millis,MA","02081":"Walpole,MA","02030":"Dover,MA","02056":"Norfolk,MA","02032":"East Walpole,MA","02062":"Norwood,MA","02071":"South Walpole,MA","01770":"Sherborn,MA","02053":"Medway,MA","02090":"Westwood,MA","01746":"Holliston,MA","02492":"Needham,MA","02038":"Franklin,MA","02482":"Wellesley,MA","01760":"Natick,MA","02067":"Sharon,MA","02027":"Dedham,MA","02026":"Dedham,MA","02457":"Babson Park,MA","02093":"Wrentham,MA","02035":"Foxboro,MA","01702":"Framingham,MA","02021":"Canton,MA","01721":"Ashland,MA","02494":"Needham Heights,MA","02137":"Readville,MA","02481":"Wellesley Hills,MA"}

使用

处理它
Alamofire.request(.GET,theURL,parameters["zip_code":theWkZip.text!]).validate().responseJSON{
            responseData in
            switch responseData.result{

            case .Success(let jJson):

                self.swiftyJsonVar = JSON(jJson)
                print(self.swiftyJsonVar)
                //self.weatherTable.reloadData()
                //self.refreshControl.endRefreshing()
            case .Failure(let error):
                print("this is the \(error)")
            }

        }     
}

当我打印出结果时我得到

{
  "02032" : "East Walpole,MA",
  "02081" : "Walpole,MA",
  "02062" : "Norwood,MA",
  "02027" : "Dedham,MA",
  "02137" : "Readville,MA",
  "02457" : "Babson Park,MA",
  "01702" : "Framingham,MA",
  "02067" : "Sharon,MA",
  "02021" : "Canton,MA",
  "01760" : "Natick,MA",
  "02053" : "Medway,MA",
  "02026" : "Dedham,MA",
  "01746" : "Hollist

这是一个完全不同的顺序,我很容易混淆为什么。然后我需要按照JSON将它们返回到程序的顺序放入表中。

由于

0 个答案:

没有答案