Here i post how to parse JSON values without using tags...
this is sample json values without tag except main tag.
this is sample json values without tag except main tag.
{
"Parsing_Json": [
"[7, Best, hello]",
"[2, Day, welcome]",
"[3, News, here]",
"[6, Test, postings]",
"[4, Mother, jsonvalues]"
]
}
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
[responseData setLength: 0];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[responseData appendData:data];
}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
NSLog(@"ERROR with theConenction");
[connection release];
[responseData release];
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
[connection release];
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
array = [(NSDictionary*)[responseString JSONValue] objectForKey:@"Parsing_Json"];
NSString *str =[NSString stringWithFormat:@"%@",array];
for (int i=0; i<[array count]; i++)
{
NSString *member=[array objectAtIndex:i];
NSArray *array1 =[member componentsSeparatedByString:@","];
NSString *n1=[array1 objectAtIndex:0];
NSString *n2=[array1 objectAtIndex:1];
NSString *n3=[array1 objectAtIndex:2];
}
}
In above n1, n2 and n3 string values are parsed from JSON values. This is very easy method to getting JSON values without using tags except head tag.
Thanks...