iphone - Set same key order as json has ios -


what want maintain json key order. i'm getting json server , convert nsmutabledictionary change order, should in same order json has. , if change key order in server effect application.

here code convert json nsmutabledictionary :

nsmutabledictionary *json = [nsjsonserialization jsonobjectwithdata:datas   options:0 error:nil]; 

here json comes server :

{   "data": {       "vehicle body/inside vehicle": [        ],       "tranmission": [        ],       "brakes": [        ],       "steering": [        ],       "engine checks/under bonnet": [        ]     }, } 

but after convert dictionary changes order in ascending order.

send json data here

    var data: string()     func converttodictionary(text:string)-> any?{      if let data = text.data(using: .utf8){         do{             return try jsonserialization.jsonobject(with: jsondata, options: []) as?         } catch{             print(error.localizeddescription)         }     }     return nil }        if let jsonlist = self.converttodictionary (text: data) as? [anyobject]{         in jsonlist as! [[string: anyobject]]{           data = i["data"] as! string             print(data)             }          } 

i did way


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -