如何将SwiftyJSON字符串数组快速保存到数组的字符串中
let jsonStr: JSON = JSON(socketDictionary.myStructValue)
print(jsonStr)
输出为:
["1CZ3isxgnmrY8w1eUJmCjNSm2fvhfXYkNQ","12ZKF9uZnaz5Wk6wVvmphE42LjM5M51upV","1LzPBqfrsdxDeFkeZqSGuaS3zxw8wTRQXx","1Z5qe2NSZyzvoNbmU7tuB7AaH7i4JQJXJ","15BKJq6Q2QHdw8v93JwBqy5GKrbLDWbbUR","1DCVJrzfZrFxqBGRF3H744SB1dC8aw5Rgn","1QGsCPM2HLfAMyFdfWddzijbzXF6cwm7RA","1QGW6T2KLTuWuu5qkfmZ8E63amtZmasRSu","1CLSGF92T8936tfm9qKG4N6cQir7AKSM7Q","1C7wnv7TBaX3H3xeHycr95h9mzzvVUq9Wz","1vBegRfLZbiwyEZ9LXo4d1KbLnUEyZLpF","1Nh9mxHuXF2T6V8qwHf95T6G24EFaQRG2M","16S2TgTX4ArtNW2htUCdCk6KvAZZFfw8Xi","1J3f1UoAGwmbK1aN9vTYex5rjpDnDewtTH","1BsawvNcAs289FZv3LbZY6STweTVJk6DeW","1LSQBT7QuBBSkwyFZpsxoEuw3oBDe57DT1","1LUSG4Pm7FiiCBUcEjWduLsCjswPheHZyF","1KPD18LDsmemHUR8TyLc8C3LJRKTgxVFe5","1FASJSpNjLVTEqmM72KjrZ85H7GudbQxZn","1MZxxP5YjLh29W7tgcrtYc2ywuAjdB2FC4","1JakuQCqpcmz1husavN8dHFGQyy3yDRCrD","177D2KQ4gd6kW1b4jTs9TLjUAV927F6Wc4","1PgKwdsKBqFNsZz4JcZ82kqBXRpCbWjPae","1P2iYhmVxhg3W8tEeQQK23NY5mKxHPbNnQ","14AgWBp6XYw12cBdAvdwz3sh9issWX7UnW","1DMPZjYf9LvHe3p7ZvZTVYsasGJps5QWWu","1MncjTfvdkNp1P1z22LAgbXU8mmTi59sLw","1PLLzt7Jiww6KqfsRwM6aW4z6pHoJNiDLR","1JvGhkZ26hy1Tjmxyx8C9amzo3pt6Ecxfh","1D3P1oYE9PBJhz9HYXeVJwuM5Qgg6RdYRu","1DGaE7K1nPjoVuL7BD4y3NWZvQ8gGNzenj","1h81XFB5nLsRJu2UtPinJx3niv1LMWSj5","18tAQ6awwcecSbxT63kQBmyJm7hWQLDppe","17p9vLfD1Q3Hdxp5zCNuX4cSe7TDjvzDXc","1GAsmp3j26Y6AkMG1jtVoZFBxZnJMSWQLF","1MJa3EFHFJwY2myibcVWiB6zuofFFaBWAR","19FwYXp1vfgU7bNojsggkuVZsiiAKRxbF7","18tG7Czk2akY2qbcn651CwCWzv9QA3DKUn","1AzacPufLFp7tL593Yimg7cnu4SymganbL","1EifaT43avdWcsXMhyVHvPmtNz7YyfDEnZ","17Xax4sY5Z694QQEKKz1ioaSrxXujnoa1y","18G4HWStJBVE4k4uLnif5cKAsyXpKx3VqY","1FUKc1zh8ia2h1j8Z1DqTTVQ2cJSyx7AnW","1HQq9mQxePKZg8eDncggx9LZ3ufc6sYSPp","14mKUH5jFmEW6DiKAiGJmeztqZ46XQkxch","1JWJwbiPzehXz8D5s7jTddEDxtMLBaFfkV","1GZbEdUjBhqZfp1JAyaoCZRTCiXSa4gbty","1D69wSHc1wK778gYWogzrm2hnerCBs1ZC6","12aa3sB1DTQDGT5UQHWnU71ziLLvQHKLTr","1AF2rxRKJbtUTNH4iyX5csrrG66Y723YwP","1AR77rXiZga2XUd2W7Wk1jZQfGjtK3gDBs","1PVJqkWLEed11uHHBeH3x4ya6zSjS7sv2e","168VzjYSz3tYaYLLoF28WKoc2NzBTAM866","13SnzBJL7jrHfPCWSAS8GD4ctmKAfgvTaa","16KBupqzu8hUCzqjdgr6ZFfM9TFnRkz82u","1Pd7NY5onBAQtwjf9aKGaun8QDhuoFf7jr","1LM65ijpT6SnTwQHd6bz44RZAaaVXEmT8x","1Mzg7bLFoA5wrDT2gUk7M9JPA7yxGYGN7c","1N7Tw2KDaUWRexGCoNSa5ecZkDHdvNRw1Z","1GPRVhFa1X99VqYJuRR6wBP1vz1txWiNYQ","1JaaeGaNeytwTPh9Dwv9XdcUyfzmhDVi6a"]
我想将此json输出数组保存为简单数组,然后迭代这些数组
答案 0 :(得分:1)
只需使用SwiftyJSON中的dicionaryObject。这会将JSON值转换为[String:Any]。
例如:jsonStr.dicionaryObject