以NSString类型传递Json格式的参数

NSDictionary *categoryDic = [NSDictionary dictionaryWithObjectsAndKeys:@"技术",@"0", nil];

        if ([NSJSONSerialization isValidJSONObject:categoryDic])

        {

            NSError *error;

            NSData *categoryData = [NSJSONSerialization dataWithJSONObject:categoryDic options:NSJSONWritingPrettyPrinted error:&error];

            jsonString=[[NSString alloc] initWithData:categoryData encoding:NSUTF8StringEncoding];

            CLog(@"JSON:%@",jsonString);

        }

        [_knowledgePageClient getKnowledgeListWithStart:start limit:kHomeListLimit name:jsonString];

posted @ 2014-03-13 15:58  曈曈7添  阅读(454)  评论(0)    收藏  举报