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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:07:28+00:00 2026-05-31T09:07:28+00:00

I need to make the json params like below. Final output should be, {submissionTime:\/Date(1331549630849)\/,

  • 0

I need to make the json params like below.

Final output should be,

{"submissionTime":"\/Date(1331549630849)\/",
"statusId":"0",
"answers":[{"answer":"Yes","qid":167},{"answer":"Hello","qid":168}],

"participantId":"16369",
"token":"t_ikHOXVjlcsSb9Tfdn5RaO54JGQobHodUD5881SKevxy63jwLxe8ZPQvXYss4pR"}

I am trying to make this format. I got the time, statusid, participantid and token. Its fine. But, i am facing problem when making “answers” array.

I use the below code for making the answers json format like below.

NSArray *answerkeys = [NSArray arrayWithObjects:@"answer", @"qid",nil]; 
            NSString *qID = [NSString stringWithFormat:@"%d", [questionidArray objectAtIndex:i] ]; // for loop
            NSArray *objectkeys = [NSArray arrayWithObjects:value, qID,nil];             
            NSString *answerjsonRequest = [pSr makeJSONObject:objectkeys :answerkeys];
answerjsonRequest = [(NSString *)answerjsonRequest stringByReplacingOccurrencesOfString:@"\n" withString:@""];

[textvaluesArray addObject:[NSString stringWithFormat:@"%@", answerjsonRequest]];

and the output is like below.

    (
    "{  \"answer\" : \"Hello\",  \"qid\" : \"220421824\"}",
    "{  \"answer\" : \"How are you\",  \"qid\" : \"115781136\"}"
)

But, when i am adding all in one in the final output like below,

NSString *jsonRequest = [pSr makeJSONObject:[NSArray arrayWithObjects: participantID, (NULL!=textvaluesArray)?textvaluesArray:@"0", [NSString stringWithFormat:@"%d", statusID], subTime, [appDelegate getSessionToken], nil] :[NSArray arrayWithObjects:@"participantId", @"answers", @"statusId", @"submissionTime", @"token", nil] ];

The final json result is this.
{
  "submissionTime" : "\/Date(1331566698)\/",
  "token" : "t_hvYoxifLQhxEKfyw1CAgVtgOfA3DjeB9jZ3Laitlyk9fFdLNjJ4Cmv6K8s58iN",
  "participantId" : "16371",
  "answers" : [
    "{  \"answer\" : \"Hello\",  \"qid\" : \"220421824\"}",
    "{  \"answer\" : \"Hello\",  \"qid\" : \"115781136\"}"
  ],
  "statusId" : "0"
}

BUT, this is NOT the one what i want. My expected JSON output is top above mentioned. I tried many ways, but couldn’t achieve this. Could someone helping me on this to resolve to get the exact JSON output?

Thank you!

  • 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-31T09:07:30+00:00Added an answer on May 31, 2026 at 9:07 am

    I ran into this issue as well, and created a quick category to take care of the problem.

    @interface NSString (ReplaceForJSON)
    - (NSString*)replaceEscapedQuotes;
    @end
    
    @implementation NSString  (ReplaceForJSON)
    - (NSString*)replaceEscapedQuotes
    {
        NSString* returnVal = [self stringByReplacingOccurrencesOfString:@"\\\"" withString:@"\""];
    
        returnVal = [returnVal stringByReplacingOccurrencesOfString:@"\"{" withString:@"{"];
    
        returnVal = [returnVal stringByReplacingOccurrencesOfString:@"}\"" withString:@"}"];
    
        return returnVal;
    }
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to make multiple NSURLConnections to a JSON Web Service. I would like
I need to make a json request with the url structure like : site.com/page?id=123
I need make my method capable of accepting JSON data. Say I need to
I need to make an ajax POST request (json) to a different domain (later
I need to make a jsonp POST request with the content type 'application/json'. I
I would like to know how can we make the JSON based array using
I need to make POST request to REST web-service with header params and form
I need to make a call to a json webservice from C# Asp.net. The
I have a crystal report file I need make a tiny edit in. It
I need to make a WebCast presentation soon and need to do some whiteboarding

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.