///封装JSON字符串
func GetJson(){
//判断是否使用积分
var dictionaryOrArray : [String: AnyObject] = [:]
dictionaryOrArray["orderType"] = 0 as AnyObject?
dictionaryOrArray["remark"] = "Hello Swift" as AnyObject?
dictionaryOrArray["consume"] = 100as AnyObject?
dictionaryOrArray["orderIsintegral"] = 1 as AnyObject?
dictionaryOrArray["orderInteralamount"] = 100 as AnyObject?
dictionaryOrArray["couponId"] = 34 as AnyObject?
dictionaryOrArray["orderAmount"] = 345 as AnyObject?
dictionaryOrArray["couponAmount"] =10 as AnyObject?
dictionaryOrArray["realAmount"] = 234 as AnyObject?
dictionaryOrArray["orderFreight"] = 12.25 as AnyObject?
dictionaryOrArray["dealBy"] = 2 as AnyObject?
dictionaryOrArray["addrId"] = 12 as AnyObject?
var dataOrArray = [[String:AnyObject]]()
var i = 0
while (i < stringTest.count) {
var dataInfo : [String: AnyObject] = [:]
dataInfo["commodId"] = stringTest[i].GoodsID as AnyObject?
dataInfo["commodNum"] = stringTest[i].CommodCount as AnyObject?
dataOrArray.append(dataInfo)
i = i + 1
}
dictionaryOrArray["data"] = dataOrArray as AnyObject?
let convertResult:String = tool.convertDictionaryToString(dict: dictionaryOrArray)
print("字典转换之后的字符串:\(convertResult)")
}