Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7756761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:54:21+00:00 2026-06-01T12:54:21+00:00

I am getting data from server it gives in response a NSString which hase

  • 0

I am getting data from server it gives in response a NSString which hase json data i want that json data to be store in an array how to do this

      NSData *urlData=[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];

       NSString *data=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding];


       NSLog(data);

   NSData* data=[dataString dataUsingEncoding:NSUTF8StringEncoding];



    [self performSelectorOnMainThread:@selector(fetchedData:) 
                           withObject:data waitUntilDone:YES];



     - (void)fetchedData:(NSData *)responseData {
      //parse out the json data
       NSError* error;
       NSDictionary* json = [NSJSONSerialization 
                      JSONObjectWithData:responseData //1

                      options:kNilOptions 
                      error:&error];

     NSArray* latestLoans = [json objectForKey:@"loans"]; //2

       NSLog(@"loans: %@", latestLoans); //3
   }

here is the log of data which return from server

  [{"CodeValue":"90658","CodeDescription":"flu shot","IsActive":"1","CodeType":"CPT","CodeID":"6","UpdateDateTime":"2012-04-02 02:09:46"}]  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:54:23+00:00Added an answer on June 1, 2026 at 12:54 pm
    NSData *urlData=[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
    
    NSString *data=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding];
    
    
    NSArray *dataArr=[data JSONValue];
    
    for (int i=0; i<[dataArr count]; i++) {
    
        NSDictionary *dict=[dataArr objectAtIndex:i];
    
        NSString *codeV=[dict valueForKey:@"CodeValue"];
        NSString *codeD=[dict valueForKey:@"CodeDescription"];
        NSString *active=[dict valueForKey:@"IsActive"];
        NSString *codeT=[dict valueForKey:@"CodeType"];
        NSString *codeId=[dict valueForKey:@"CodeID"];
        NSString *updatedTime=[dict valueForKey:@"UpdateDateTime"];
    
        NSLog([dict description],nil);
    }
    
        NSLog(@"%@", json_string);
    
    
    //May this will help you out.
    

    Do include the JSon library classes to your project.

    I am doing in this way to insert in an array but it return o object

           NSDictionary *dict=[dataArr objectAtIndex:i];
    
            SearchCode *theObject =[[SearchCode alloc] init];
    
    
            theObject.codeValue=[dict valueForKey:@"CodeValue"];
            theObject.codeDescription=[dict valueForKey:@"CodeDescription"];
            theObject.codeType=[dict valueForKey:@"CodeType"];
            theObject.codeID=[dict valueForKey:@"CodeID"];
            theObject.UpdateDateTime=[dict valueForKey:@"UpdateDateTime"];
    
    
            NSLog(codeType);
    
    
    
    
            [cptArray addObject:theObject];
            [theObject release];
            theObject=nil;
    
    
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
         return [cptArray count];    
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellIdentifier = @"Cell"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    
        cell.selectionStyle=UITableViewCellSelectionStyleGray;
        cell.accessoryType = UITableViewCellAccessoryNone;
    
         }
    SearchCode *theObject =[cptArray objectAtIndex:indexPath.row];
    cell.textLabel.text=theObject.codeValue; //& so on you can access any value from "theObject" here
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im getting data from a server by executing this code: - (void) sendGeneral:(NSString *)
I have a custom list view that is getting data from server and changing
i m using this code for posting and getting the data from the server.
I'm getting data from a remote server, that can produce JSONP but needs the
I have a list view in which i m getting my data from server.
Getting error while inserting values into database (SQL Server 2008) Implicit conversion from data
I am storing some values that I am getting from server in the database
I'm calling 2 JS functions(Ajax) each of which are returning data from the server.But
how can i getting data from listbox in second form named listform while i
I am getting data from iphone using php but when i insert post data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.