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

  • Home
  • SEARCH
  • 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 8172881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:55:39+00:00 2026-06-06T21:55:39+00:00

I am developing an application, in which I’m doing the Json Parsing. Code for

  • 0

I am developing an application, in which I’m doing the Json Parsing. Code for this is like:

NSString *urlstring=@"http:www.djksfd.com";
NSURL *url=[NSURL URLWithString:urlstring];
NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:url];



NSString *str=[NSString stringWithFormat:@"'{\"keywords\":{\"appList\":[\"Real Drum\",\"Tabla\",\"Adobe Flash Player 11.1\",\"Adobe Reader\",\"Aldiko\"],\"genreMap\":{\"Soundtrack\":\"38\",\"Hindi\":\"182\",\"0\":\"10\",\"Pop\":\"2\",\"Other\":\"4\"}}}'"];

 NSData *data=[str dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:str forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody:data];


NSHTTPURLResponse* urlResponse = nil; 
NSError *error = [[NSError alloc] init];  
responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *result1 = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"Response Code: %d", [urlResponse statusCode]);
// if ([urlResponse statusCode] >= 200 && [urlResponse statusCode] < 300) 
//{
NSLog(@"Response: %@", result1); 

And the response is as below:

 <html><head><title>Apache Tomcat/7.0.27 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.NullPointerException
com.mthsense.web.rest.DefaultExceptionMapper.toResponse(DefaultExceptionMapper.java:29)
com.mthsense.web.rest.DefaultExceptionMapper.toResponse(DefaultExceptionMapper.java:1)
org.jboss.resteasy.core.SynchronousDispatcher.executeExceptionMapper(SynchronousDispatcher.java:330)
org.jboss.resteasy.core.SynchronousDispatcher.unwrapException(SynchronousDispatcher.java:359)
org.jboss.resteasy.core.SynchronousDispatcher.handleReaderException(SynchronousDispatcher.java:422)
org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:230)
org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:196)
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:551)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:513)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:125)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.27 logs.

Apache Tomcat/7.0.27

.

So please tell me how to get the correct response, and how to solve this error.

  • 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-06T21:55:41+00:00Added an answer on June 6, 2026 at 9:55 pm

    i Think you have invalid json string ..please check it out .. in you json string i think you missed this bracket “[“.. please check it out… I think you need this json….

    {
    "keywords": {
        "appList": [
            "Real Drum",
            "Tabla",
            "Adobe Flash Player 11.1",
            "Adobe Reader",
            "Aldiko"
        ],
        "genreMap": {
            "Soundtrack": "38",
            "Hindi": "182",
            "0": "10",
            "Pop": "2",
            "Other": "4"
           }
        }
    }
    
    
    
    NSMutableDictionary *dict1 = [[NSMutableDictionary alloc] initWithCapacity:0];
    
    NSMutableDictionary *dict2 = [[NSMutableDictionary alloc] initWithCapacity:0];
    NSMutableArray *arr = [[NSMutableArray alloc] initWithObjects:@"Real Drum",@"Tabla",@"Adobe Flash Player 11.1",@"Adobe Reader",@"Aldiko",nill];
    
    [dict2 addObject:arr forKey@"appList"];
    
    NSMutableDictionary *dict3 = [[NSMutableDictionary alloc] initWithCapacity:0];
    [dict3 addObject:@"38" forKey:@"Soundtrack"]
    [dict3 addObject:@"182" forKey:@"Hindi"]
    [dict3 addObject:@"10" forKey:@"0"]
    [dict3 addObject:@"4" forKey:@"Other"]
    [dict2 addObject:dict3 forKey:@"genreMap"];
    [dict2 release];
    [dict1 addObject:dict2 forKey:@"keywords"];
    [dict2 release];
    
    NSString *jsonString = [jsonWriter stringWithObject:dict1];
    
    NSData *data=[jsonString dataUsingEncoding:NSUTF8StringEncoding];
    [request setHTTPMethod:@"POST"];
    [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [request setValue:str forHTTPHeaderField:@"Content-Length"];
    [request setHTTPBody:data];
    
    
    NSHTTPURLResponse* urlResponse = nil; 
    NSError *error = [[NSError alloc] init];  
    responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
    NSString *result1 = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
    NSLog(@"Response Code: %d", [urlResponse statusCode]);
       // if ([urlResponse statusCode] >= 200 && [urlResponse statusCode] < 300) 
       //{
        NSLog(@"Response: %@", result1); 
    

    try to enclose this into string…

    may this will help you..

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

Sidebar

Related Questions

I`m developing an application which receives data from my GPS device like coordinates, speed
I am developing an application which users authlogic for authentication. I would like some
I developing application which using geo-location. Should i ask user right for this when
I'm developing application which needs to have functionality similer like built in Android SMS
I am developing an application which simulates datacubes and their operation. For this application
Hi i am developing android application which read the QR Code. Now for that
I am developing application which is having Gujarati font in text-view but my problem
When developing an application which mostly interacts with a database, what is a good
We are developing an application which is read heavy and could possibly have millions
I am developing an application which needs to connect to an embedded bluetooth device,

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.