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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:23:54+00:00 2026-05-26T13:23:54+00:00

I am working on an iPhone app which involves using json-framework.I am getting array

  • 0

I am working on an iPhone app which involves using json-framework.I am getting array using NSURL

[{"firstName":"X","lastName":"Y","id":1},{"firstName":"A","lastName":"B","id":2}]

How can i get these 2 objects as like if i query for id=1, the O/P is

id=1
firstName:X
lastName:Y

and putting it in a table.
I am googling the stuff from many days but didn’t get any solution.
Please help me out , explanation through code is appreciated.

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-26T13:23:55+00:00Added an answer on May 26, 2026 at 1:23 pm

    If your target SDK is ios4 or higher, you can use this project

    https://github.com/stig/json-framework/

    Once you add the source to your project, just

    #import "SBJson.h"
    

    and convert your Json string as follows

    jsonResponse = [string JSONValue];
    

    The method will fail if you don’t have the full Json array in your string, but you can keep appending strings until it doesn’t fail

    To follow up for codejunkie’s request below
    you can assume in your data structure that the jsonResponse is an NSArray
    In other implementations take care to test the response for NSArray or NSDictionary

    NSArray * myPeople = [string JSONValue]; 
    NSMutableDictionary * organizedData = [[NSMutableDictionary alloc] init];
    for (NSDictionary * p in myPeople) {
        [organizedData setValue:p forKey:[p valueForKey:@"id"]];
    }
        // now you can query for an id like so
        // [organizedData valueForKey:@"1"]; and your output will be what you wanted from the original question
        // just don't forget to release organizedData when you are done with it
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an iPhone app using objective C. I've got class A, which
I am working on an iPhone app which is using an external library for
I am working an iPhone app which is using CLLocationManager. When a user goes
I'm working in a iPhone app that needs to send a array as a
The iPhone app that I am working on requires GET calls to a 3rd
Im working on an iphone web app using JQTouch , im just wondering what
i'm working on iphone app which will show 4 buttons in first view. on
I'm working on a iPhone app which has a pretty large UITableView with data
I am working on an update for my new iphone app which will include
I'm working on an iPhone app using the 3.1.3 SDK, my app finds the

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.