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 4620644
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:35:19+00:00 2026-05-22T02:35:19+00:00

When parsing json service , it works fine for first time , but during

  • 0

When parsing json service , it works fine for first time , but during second time it gave me the error given below

-JSONValue failed. Error trace is: (
"Error Domain=org.brautaset.JSON.ErrorDomain Code=11 \"Unexpected end of string\" UserInfo=0x5f57450 {NSLocalizedDescription=Unexpected end of string}"  

Thanks in advance

Code start parsing:

NSString *urlString = [NSString stringWithFormat:@"http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsSearch?term=%@",tt.text];

parsing code ::

    - (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 {
    UIAlertView *alert =[[UIAlertView alloc]initWithTitle:@"error" message:@"Problem with parsing data" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
    [alert show];
    [alert release];
    [UIApplication sharedApplication].networkActivityIndicatorVisible=NO;
    self.responseData = nil;
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
    NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
    self.responseData = nil;
    NSLog(@"%@",[responseString JSONValue]);
    NSArray* latestLoans = [(NSDictionary*)[responseString JSONValue] objectForKey:@"results"];
    [responseString release];
    NSLog(@"count === %d",[latestLoans count]);
        for (int i = 0; i < [latestLoans count]; i++)
        {
            NSLog(@" inside for loop %@",[latestLoans objectAtIndex:i]);
            NSDictionary* loan = [latestLoans objectAtIndex:i];
            NSLog(@" trackanme=== %@",[loan objectForKey:@"collectionName"]);
                NSLog(@" artworkurl=== %@",[loan objectForKey:@"artworkUrl60"]);
            [titlearray addObject:[loan objectForKey:@"collectionName"]];
            [imagelink addObject:[loan objectForKey:@"artworkUrl60"]];

        }
    //get latest loan

    NSLog(@"titlearray count == %d",[titlearray count]);
    NSLog(@"imagelink count ===%d",[imagelink count]);
    //fetch the data
    //NSString* fundedAmount = [loan objectForKey:@"Kind"];
    //NSNumber* loanAmount = [loan objectForKey:@"loan_amount"];
    //float outstandingAmount = [loanAmount floatValue] - [fundedAmount floatValue];

        //NSString* country = [(NSDictionary*)[loan objectForKey:@"location"] objectForKey:@"country"];

    //set the text to the label
    //label.text = [NSString stringWithFormat:@"Latest loan: %@ from %@ needs another $%.2f, please help",
    //            name,country,outstandingAmount
    //            ];    
    [UIApplication sharedApplication].networkActivityIndicatorVisible=NO;
    [tbl reloadData];
}


    NSLog(@"url ===%@",urlString);
    // Create NSURL string from formatted string, by calling the Flickr API
    NSURL *url = [NSURL URLWithString:urlString];


    // Setup and start async download
    NSURLRequest *request = [[NSURLRequest alloc] initWithURL: url];
    NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
    [connection release];
    [request release];

This is the code of my request, this called every time i press button :

-(IBAction)searchitem:(id)sender
{[UIApplication sharedApplication].networkActivityIndicatorVisible=YES;


[tt resignFirstResponder];

NSString *urlString = [NSString stringWithFormat:@"http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsSearch?term=%@",tt.text];

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];


}
  • 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-05-22T02:35:19+00:00Added an answer on May 22, 2026 at 2:35 am

    The problem was , i did not link my json framework well , i tried new framework available at github and it works fine.

    Thanks for all who contributed their ideas and lead me to right direction for solving the problem .

    Thank you very much………

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am doing JSON parsing for particular web service with different IDs,Parsing returns some
I have a REST-service that returns JSON. But the JSON response returned with \
From a previous question on Stackoverflow Iterating through/Parsing JSON Object via JavaScript .... My
I'm parsing a json feed routinely and need to insert only the newest users
I'm having difficulty parsing some JSON data returned from my server using jQuery.ajax() To
I'm having a problem parsing a JSON file in AS3. Im trying to parse
I'm work with GWT and parsing a JSON result from an ASP.NET webservice method
I'm making pretty heavy use of JSON parsing in an app I'm writing. Most
Am am successfully parsing and sending JSON values from my client for my server
I am currently trying to pass a generated JSON string to dojo for parsing

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.