如何从xss中取消或解压缩json密钥(来自API)?

时间:2017-01-19 07:51:30

标签: ios objective-c json xcode zip

这是JSON响应中的压缩API值:

"response": {
"Status": 1,
"assetdescription": null,
"lastgatewayreport": "H4sIAAAAAAAAAM2V227jNhCGX4XQNaPwoAOlu7TuJi26ycJJG6BFYTAi4xCQRIOk3WSLfZg+S1+sI9mOLUeLJJvdor6x+c8MNfw1H/37X5H0XgejopLytMDrZSsbHZXRT6ZpHh4iHM2dXS424kTfymUdtmpXWXCBIyUD7NOnEHFM2TEjNEM0K5OiZAWk38gQojJJcaTvg9etty4qjyjpPjHB0d2yMcqEh4EYdLPQToalg41ZGgu+1rxeadcnQ1Jt5ndhULZw2vu+pl82NhjbQmfnJ9CI897A71NrFaxq2XVF4kTkoihy0SvKuC67C3d1eRonHMJZzntlHb6GsF9orTZPmS+8D9Cqh1j3HFib9tbC6ohCcyUrCSlpkZRMlJxpXjJ+y0rO16mNVdAu7K8M7NJW297vtFSmnXe2xgRS4eBt/74i0R8XpLbZiZ3Txm77YLCBVKpzA2I0z3J0bVqFzkxdo6nC6HtrwV9/s3RzjD6cICoIzzD65bI7gKzNCtq4lbXXnS0+rEBSY47tQnvWPapPPdwL7cx8VJ+dpUrX20ZY3tu0UbonDRRZVRsje482Q3xuXSNrPL28mn24mPbf311Mpvs97GxbD438cz03RxntR2SmDk2wbacdfeagYxV7LhyWfsIDNEU6RPPcNDe1np2+Hk5Kj8HTtaFFSURJs0c4c/LlcFI4WX4IZ/I14OQszknOBCdsDE5K85hmKUmyrPjGdCbfkk7OU3SNzqS7sQ5NHEaXskUTo+cWMD1BBaOEvoTMA7ueJ/PAwBejOT5J/ymar/FslOChWRsMP2fIWMkhwvu1Q4ZTIoYMX2kfZlN9Z+ZfQDHcidmj9ykp2Y5i/gaKOY3JE4q/yl8s4zFLRJJzOgoxyeIkTcFV9n9iWEDH4hUM/2oqSNPodKmd0w6m8DfbSjSxTiqJkWCUEvRefpSh/ufvFsbVtDFG7/W9qewzWA/9ewHVA0dfDvXoYL0V6h8v6Ozi3Tv8czdGaKKDrgKeaq/dSqtZgq9kN4PopApmBb3gs/UrQT/cV/D28avuhDe+g9FrYmD+lvRxg0cKntwRu8pPf/wLveleYoMLAAA=",
"Msg": "Success"
}

这应该是这样的

"response": {
"Status": 1,
"assetdescription": null,
"lastgatewayreport": [
  {
    "assetid": 1359,
    "assetname": "Jimmyy",
    "assetgroupname": null,
    "groupname": "Default",
    "groupid": 938,
    "datetime": "08/12/2016 16:49:29",
    "batt": 45,
    "extsensor": -100000,
    "extsensortype": null,
    "humidity": -100000,
    "temperatur .......

解压缩内容的NSArray

NSDictionary

我已尝试转换为NSData,然后转换为JSONObjectWithData但无效。

如何在目标c中解压缩该json密钥。我正在使用AFNetworking。是否可以解压缩这些内容。

1 个答案:

答案 0 :(得分:0)

内容是gziped(在此处输入:http://www.txtwizard.net/compression)。获得数据后,您必须将其解压缩,然后运行$_product = wc_get_product( id ); 。我有使用https://github.com/nicklockwood/GZIP gzip和ungzip数据的良好经验。