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

The Archive Base Latest Questions

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

I’ve exhausted other threads, so I’m posting this question here. Please pardon any newbie

  • 0

I’ve exhausted other threads, so I’m posting this question here. Please pardon any newbie mistakes I’ve made along the way. I’ve been reading a lot, and I think I’m getting confused.

The Goal:
I’m trying to pass data from a form in objective-c to my django web service. In an effort to assist with this, I’ve employed the ASIHTTPRequest class to facilitate information transfer. Once sent to the web service, I’d like to save that data to my sqlite3 database.

Procedure:
On the Objective-C side:
I’ve stored the inputted form data and their respective keys in an NSDictionary, like this:

NSDictionary *personInfo = [NSDictionary dictionaryWithObjectsAndKeys:firstName.text, @"fName", middleName.text, @"mName", lastName.text, @"lName", nil];

I’ve added it to my ASIHTTPRequest in a different class by using a delegate. I’ve made the NSDictionary the same as above in the code block below for simplicity, like so:

NSString *jsonPerson = [personInfo JSONRepresentation];
[request addRequestHeader: @"Content-Type" value:@"application/json; charset=utf-8"];
[request appendPostData:[jsonPerson dataUsingEncoding:NSUTF8StringEncoding]];
[request setRequestMethod:@"POST"]; 
[request startAsynchronous]; 

And a NSLog shows the string I’m passing to look like this, which validates at least in JSONLint

{"mName":"Arthur","lName":"Smith","fName":"Bob"}

Because I’m seeing what appears to be valid JSON coming from my ASIHTTPRequest, and actions are running from requestfinished: rather than requestfailed:, I’m making the assumption that the problem more than likely isn’t on the Objective-C side, but rather on the django side.

Here’s what I’ve tried so far:

json.loads(request.POST)
>>expected string or buffer

json.loads('request.POST')
>>no JSON object to decode

json.loads(request.raw_post_data)
>>mNamelNamefName

incoming = request.POST
>>{"mName":"Arthur","lName":"Smith","fName":"Bob"}

incoming = request.POST
onlyValues = incoming.iterlists()
>>(u'{"mName":"Arthur","lName":"Smith","fName":"Bob"}', [u''])

…and a smattering of other seemingly far-fetched variations. I’ve kept a log, and can elaborate. The only hope I’ve been able to find is in the last example; it looks like it’s treating the entire string as the key, rather than breaking up each dict object and key as I would have expected.

I realize this is terribly elementary and I don’t normally ask, but this problem has me particularly stumped. I do also remember reading somewhere that python won’t recognize the double-quotes around each object and key, that to get it to something django likes, each should be surrounded by single-quotes. I just don’t have any idea how to get them that way.

Thanks!

  • 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:58:30+00:00Added an answer on May 22, 2026 at 2:58 am

    This might be a little cumbersome but you may try some simple regexp in objective c just to see if that is really the case

    NSError *error = NULL;
    NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\"" options:NSRegularExpressionCaseInsensitive error:&error];
    NSString *json = [regex stringByReplacingMatchesInString:jsonPerson options:0 range:NSMakeRange(0, [jsonPerson length]) withTemplate:@"'"];
    

    There might be some errors because I didn’t run the code.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have some data like this: 1 2 3 4 5 9 2 6
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.