我收到以下字符串應該是JSON如何獲得鑰匙JSON作爲對象
{\"CUPS\":\"890201\",\"Cama\":\"\",\"Cantidad\":1,\"Cargo_Autorizador\":\"\",\"Cargo_Remisor\":\"\",\"Celular_Autorizador\":\"\",\"Celular_Protegido\":\"30129193\",\"Celular_Remisor\":\"\",\"Ciudad_Autorizador\":\"BOGA - CUNDIRCA\",\"Cod_Descripcion\":\"\",\"Codigo_Entidad_Pagadora\":\"EP002 \",\"Codigo_Prestador\":\"152310\",\"Consecutivo_Impresion_Web\":\"\",\"DescripcionErrorNegocio\":null,\"Diagnóstico\":\"-M25.5\",\"Direccion_Autorizador\":\"AV N° 66A-27 \",\"Direccion_Prestador\":\"AV N° 66A-27 \"}
但是序列化的NSDictionary我留下了關鍵的空間,但nill
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:encodData options:kNilOptions error:nil];
在日誌中
:
json=(NSDictionary *) 62 key/value pairs
[0]
[1]
[2]
[3]
我嘗試從每個鍵的數據傳遞到一個NSArray的
NSArray *typeArray=[[NSArray alloc]initWithArray:[json valueForKey:@"CUPS"]];
,但它會產生一個錯誤
'-[__NSCFString count]: unrecognized selector sent to instance 0x7fb28ab973f0'
我需要得到一個NSArray的每個鍵的值
「杯具」的值是不是一個數組,它是一個字符串。 –