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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:08:26+00:00 2026-06-05T08:08:26+00:00

I have the following JSON array: [u’steve@gmail.com’] u is apparently the unicode character, and

  • 0

I have the following JSON array:

[u'steve@gmail.com']

“u” is apparently the unicode character, and it was automatically created by Python. Now, I want to bring this back into Objective-C and decode it into an array using this:

+(NSMutableArray*)arrayFromJSON:(NSString*)json
{
    if(!json) return nil;
    NSData *jsonData = [json dataUsingEncoding:NSUTF8StringEncoding];
   //I've also tried NSUnicodeStringEncoding here, same thing
    NSError *e;
    NSMutableArray *result= [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&e];
    if (e != nil) {
        NSLog(@"Error:%@", e.description);
        return nil;
    }
    return result;
}

However, I get an error: (Cocoa error 3840.)" (Invalid value around character 1.)

How do I remedy this?

Edit: Here’s how I bring the entity from Python back into objective-c:

First I convert the entity to a dictionary:

def to_dict(self):
    return dict((p, unicode(getattr(self, p))) for p in self.properties()
                if getattr(self, p) is not None)

I add this dictionary to a list, set the value of my responseDict[‘entityList’] to this list, then self.response.out.write(json.dumps(responseDict))

However the result I get back still has that ‘u’ character.

  • 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-05T08:08:27+00:00Added an answer on June 5, 2026 at 8:08 am

    [u’steve@gmail.com’] is the decoded python value of the array it is not valid JSON.

    The valid JSON string data would be just ["steve@gmail.com"].

    Dump the data from python back into a JSON string by doing:

    import json
    python_data = [u'steve@gmail.com']
    json_string = json.dumps(data)
    

    The u prefix on python string literals indicates that those strings are unicode rather than the default encoding in python2.X (ASCII).

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

Sidebar

Related Questions

I have the following json array of objects in my code var groups =
I have the following JSON array: <?php $json = { status: OK, results: [
I have the following JSON in a file list.txt : { bgates:{first:Bill,last:Gates}, sjobs:{first:Steve,last:Jobs} }
I have the following JSON string, which was an Objective C array then encoded
I have following array return from server side: [json] => Array ( [0] =>
with reference of this question Sort json array I have the following JSON String
I have the following code $curl_handle = curl_init(); $api_url = 'http://api.twitter.com/1/statuses/home_timeline.json'; curl_setopt($curl_handle, CURLOPT_URL, $api_url);
I have this following method that connectss to db and returns a json array.
I have a JSON array like this [{Email:someone@some.com,Name:ACO,Groups:[MOD_SW,MOD_PI,MOD_GE],Id:63,Url:aco}, {Email:someone@some.com,Name:Agpo,Groups:[MOD_PI],Id:22,Url:agpo}, {Email:someone@some.com,Name:Akatherm,Groups:[MOD_SW],Id:64,Url:akatherm}, {Email:someone@some.com,Name:Albrand,Groups:[MOD_PI,MOD_GE],Id:23,Url:albrand}] I want to
I have the following json object in python: jsonobj = { a: { b:

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.