-3

JSON配列のsoap応答文字列でsoap応答を解析する方法:-

NSString *string=@"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\ "http://www.w3.org/2001/XMLSchema\">http://tempuri.org/\">[{\"rest_id\": 1, \"rest_name\": \"水筒 21\" , \"rest_address\": \"janakpuri\",\"clientid\": 1, \"rest_lat\": \"28.619713\",\"rest_long\": \"77.088404}]";

NSData *webData = [string dataUsingEncoding:NSASCIIStringEncoding];
NSError *e = nil;
NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData: webData options: NSJSONReadingAllowFragments error: &e];
4

1 に答える 1

1

NSJSONSerialization を使用します。

ドキュメントに従って、NSJSONSerialization クラスを使用して、JSON を Foundation オブジェクトに変換し、Foundation オブジェクトを JSON に変換します。

[{\"rest_id\": 1, \"rest_name\": \"canteen 21\", \"rest_address\": \"janakpuri\",\"clientid\": 1, \"rest_lat\": \ "28.619713\",\"rest_long\": \"77.088404}]"

この部分は json であり、解析できるので、この部分を文字列に取得するコードを作成し、解析を行います

于 2013-04-18T11:35:52.323 に答える