需要转换的字符串:
[{"description": "嗨","id":2,"img":"hi.png"},{"description": "宠物","id":10,"img":"pet.png"},{"description": "你好! :D","id":12,"img":"hello.png"}]
用于转换字符串的代码:
var json = JSON(stringLiteral: stringJSON)
该字符串已被转换为JSON格式。当我尝试计算此JSON中有多少块(期望的答案= 3)时,结果为0。
print(json.count)
控制台输出:0
我错过了什么?非常感谢您的帮助。