Parse JSON in iphone application with json-framework

后端 未结 2 1660
醉酒成梦
醉酒成梦 2021-01-26 17:32

I am new in iphone development.I am using currency converter in my apps. I don\'t have any idea how to parse json with this url http://www.google.com/calculator?. I want to sen

2条回答
  •  有刺的猬
    2021-01-26 17:53

    Using SBJson:

    NSString *json = @"{lhs: "2 U.S. dollars",rhs: "89.7988506 Indian rupees",error: "",icc: true}"
    
    NSDictionary *jsonDict = [json JSONValue];
    
    NSString *lhs = [jsonDict objectForKey:@"lhs"];
    NSString *rhs = [jsonDict objectForKey:@"rhs"];
    ...
    

提交回复
热议问题