NSDictionary to json string to json object using SwiftyJSON

前端 未结 2 1971
[愿得一人]
[愿得一人] 2021-02-09 07:33

I have a use case where I have an array of dictionaries and I need them as a json object:

var data = [Dictionary]()
//append items 
var byt         


        
2条回答
  •  时光取名叫无心
    2021-02-09 08:07

    According to the docs, this should be all you need.

    var data = [Dictionary]()
    //append items 
    var jsonObj = JSON(data)
    
    println(jsonObj)
    println(jsonObj[0])
    

    Are you having a problem with converting an array directly into a JSON object?

提交回复
热议问题