Json数据与Json数据转换
1.json数据
[{\"IS_DISTRIBUTOR_LIMIT\":0,\"PROVISION_PRICE\":null,\"PRO_STATUS\":\"1\",\"ATTACHMENT\":\"fangan_photo.png,716\",\"DIS_LABEL\":15,\"PRODUCT_NAME\":\"55\",\"REMARK\":null,\"PRICE_MARKET\":55,\"AMOUNT_LIMIT\":null,\"IS_NEW\":0,\"VALIDITY_END_DATE\":\"2016-08-31 00:00:00\",\"PRODUCTID\":341,\"PRICE\":12,\"SCENIC_NAME\":\"\U666f\U533a\U6d4b\U8bd51\",\"SCENICID\":5,\"ORDER_TYPE\":0,\"REGION_NAME\":\"\U4e0a\U6d77\U5e02\"},{\"IS_DISTRIBUTOR_LIMIT\":0,\"PROVISION_PRICE\":12,\"PRO_STATUS\":\"1\",\"ATTACHMENT\":\"fangan_photo.png,716\",\"DIS_LABEL\":15,\"PRODUCT_NAME\":\"\U6d4b\U8bd5\U9000\U6b3e\U65f6\U6548\",\"REMARK\":null,\"PRICE_MARKET\":12,\"AMOUNT_LIMIT\":null,\"IS_NEW\":0,\"VALIDITY_END_DATE\":\"2016-08-31 00:00:00\",\"PRODUCTID\":881,\"PRICE\":12,\"SCENIC_NAME\":\"\U666f\U533a\U6d4b\U8bd51\",\"SCENICID\":5,\"ORDER_TYPE\":0,\"REGION_NAME\":\"\U4e0a\U6d77\U5e02\"}]
2.json数据转换成数组或字典
/**1.先转换成NSData*/ NSData *jsonData = [jsonStr dataUsingEncoding:NSUTF8StringEncoding]; NSError *err; /**2.然后将NSData转换成相应的类型,如数组*/ NSArray *dataArray = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:nil];
将来的自己,会感谢现在不放弃的自己!