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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:55:31+00:00 2026-06-01T06:55:31+00:00

This answer seems to show how to make a JSONObject. NSString *jsonString = @[{\id\:

  • 0

This answer seems to show how to make a JSONObject.

NSString *jsonString = @"[{\"id\": \"1\", \"name\":\"Aaa\"}, {\"id\": \"2\", \"name\":\"Bbb\"}]";
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *e = nil;
NSMutableArray *json = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&e];
NSLog(@"%@", json);

The output looks like a json object. But then I tried the following:

NSLog(@"%@", [NSJSONSerialization dataWithJSONObject:json options:NSJSONWritingPrettyPrinted error:nil ]);

What I got back was

<5b0a2020 7b0a2020 20202269 6422203a 20223122 2c0a2020 2020226e
616d6522 203a2022 41616122 0a20207d 2c0a2020 7b0a2020 20202269
6422203a 20223222 2c0a2020 2020226e 616d6522 203a2022 42626222
0a20207d 0a5d>

This seems to show that it isn’t a real JSONObject. How do you make one?

  • 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-01T06:55:32+00:00Added an answer on June 1, 2026 at 6:55 am

    It may be a real JSONObject, but NSLog doesn’t know how to display raw data… the "%@" bit in NSLog wants a NSString with an encoding, not NSData.

    There are two ways I can see off the top of my head to tell if things worked out okay.

    #1) use the [isValidJSONObject:] method

    or

    #2) re-parse the JSON object you just created and see if it comes out the way you created it. You can print out the NSData by doing something like:

    NSError * error = nil;
    NSData * jsonData = [NSJSONSerialization dataWithJSONObject:json options:NSJSONWritingPrettyPrinted error:&error ];
    if(jsonData == nil)
    {
        NSLog( @"error in parsing json data is %@", [error localizedDescription] );
    } else {
        NSString * jsonString = [[NSString alloc] initWithData: jsonData encoding: NSUTF8StringEncoding];    
        NSLog( "json data is %@", jsonString );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems to be returning the correct answer, but I'm not sure if this
This seems like it should be really easy but I couln't find an answer
I googled this and it seems that no one has an answer, yet it
I apologize if this is a duh question. It seems like the answer should
I can't seem to find an answer on this and just want to make
As demonstrated in this answer I recently posted, I seem to be confused about
i cannot seem to find the answer to this. i uploaded code to pastebin
I cannot seem to find the answer to this I am looking for a
I've searched for the answer to this question but I can't seem to find
Hopefully this question has a simple answer i'm overlooking! I have an IIS webserver

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.