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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:24:25+00:00 2026-05-19T15:24:25+00:00

I am trying to use Json in my iphone projects , but i didnt

  • 0

I am trying to use Json in my iphone projects ,
but i didnt get how can I start using json in my project.

help me out from this condition.
Thanks in advance.

  • 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-19T15:24:26+00:00Added an answer on May 19, 2026 at 3:24 pm

    Well if you want you can get started by this

    http://iosdevelopertips.com/networking/iphone-json-flickr-tutorial-part-1.html

    this tutorial will help you understand what json does, but if you want to started on using it in your code than you should use the following example:

    April 26, 2009
    Dealing with JSON on iPhone
    You can easily use the JSON (JavaScript Object Notation) data format in client-server communications 
    when writing an iPhone app. This blog is not suggesting that JSON is a more superior format for data 
    exchange than its counterparts such as XML. In fact, we have many projects that don't use JSON.
    However, handling JSON is relatively straight forward in ObjectiveC.
    Unfortunately, Apple iPhone SDK (as of this writing, the latest is iPhone 2.2.1) doesn't come with 
    a built-in JSON parser. But I found out a good one called json-framework. It is both a generator 
    and a parser. As a generator, json-framework can create JSON data from an NSDictionary. As a parser, 
    you can pass to json-framework an NSString that consists of JSON data and it will return a 
    NSDictionary that encapsulates the parsed data.
    
    Next, I'm going to show you several examples. Before you proceed, download the library and make 
    sure you add it to your SDK path list (see INSTALL file that comes with it). If setup properly, 
    you should be able to start using the library by importing its header file:
    
    #import "JSON/JSON.h"
    
    Consider the following code:
    
        NSDictionary *requestData = [NSDictionary dictionaryWithObjectsAndKeys:
                             @"grio", @"username",
                             @"hellogrio", @"password",
                              nil];
    
    This instantiates a new dictionary which we'll turn into a JSON string. To do so, you'll need to 
    use a function called JSONRepresentation. This function is added as a category to NSObject. It 
    means that as long as there's an import of JSON.h file, you can call the function on any NSObject 
    object.
    
        NSString* jsonString = [requestData JSONRepresentation];
    
    And this is what you got when you print (NSLog(@"%@", jsonString);):
    
        {"username":"grio","password":"hellogrio"}
    
    Parsing is just as simple. Consider the following JSON data:
    
    {
        "menu": {
            "id": "file",
            "value": "File",
            "popup": {
                "menuitem": [
                {
                    "value": "New",
                    "onclick": "CreateNewDoc()"
                },
                {
                    "value": "Open",
                    "onclick": "OpenDoc()"
                },
                {
                    "value": "Close",
                    "onclick": "CloseDoc()"
                }
                ]
            }
        }
    }
    
    Assume that this is the data that you received from a web service called and is currently stored 
    in an NSString called jsonResult. To parse it, you need to create SBJSON object and call one of 
    its initialization method, objectWithString.
    
        SBJSON *json = [[SBJSON new] autorelease];
        NSError *jsonError;
        NSDictionary *parsedJSON = [json objectWithString:jsonResult error:&jsonError];
    
    If parsing fails for reasons such as invalid construct of JSON format, jsonError variable will 
    be filled with the error info. If it is successful, parsedJSON will contain keys whose values 
    are either an NSString or NSDictionary. Let's look at the inside of parsedJSON:
    
        NSDictionary* menu = [parsedJSON objectForKey:@"menu"];
        NSLog(@"Menu id: %@", [menu objectForKey:@"id"]);
        NSLog(@"Menu value: %@", [menu objectForKey:@"value"]);
    
    And here's the output:
    
        Menu id: file
        Menu value: File
    
    Observe the JSON data again. popup is an NSDictionary which has an array of menuitem.
    
        NSDictionary* popup = [menu objectForKey:@"popup"];
        NSArray* menuItems = [popup objectForKey:@"menuitem"];
        NSEnumerator *enumerator = [menuItems objectEnumerator];
        NSDictionary* item;
        while (item = (NSDictionary*)[enumerator nextObject]) {
            NSLog(@"menuitem:value = %@", [item objectForKey:@"value"]);
        }
    
    And this is the output:
    
        menuitem:value = New
        menuitem:value = Open
        menuitem:value = Close
    

    Sorry i forgot the link to this website

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

Sidebar

Related Questions

I'm trying to use Json with my database using php5 but suffering from a
I'm trying to use ASIFormDataRequest for iphone to get some values from my mysql
I'm trying to use the JSON library to consume twitter information from the get
I'm trying to use JSON parsing from RestKit, but I'm receiving the following compile
I am trying to use a web service built on asp.net wcf from iPhone
I am trying to use JSON.stringify() (from json2.js of json[dot]org ) to convert a
I am trying to use JSON and HTTP client to retrieve data from a
Im trying to learn how to use JSON from within codeigniter. I'm trying to
I'm trying to use a Json View for Spring ( http://spring-json.sourceforge.net/ ) (org.springframework.web.servlet.view.json.JsonView) but
I am trying to use JSON for getting dynamic content to my webpage, using

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.