Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use JSON object as variable in objective c?
    primarykey
    data
    text
    <p>I'm developing an Server-Client application in Xcode 4.2</p> <p>The application saves some user informations and sends them in a HTTP GET request to server via server url.</p> <p>As response, I have text like this: </p> <pre><code>2011-12-30 15:44:02.120 smartHome[340:f803] { button = 1; key = 181abc88e57c37a42769; message = ( { ID = 1; date = "2011-12-10 16:00:00"; message = asdf; status = 1; "user_id" = 2; } ); "wrong_user" = 0; } </code></pre> <hr> <p>(2/Jan/2012) Sorry for such confusing edits but i haven't overcome my deal yet. I need to parse this JSON text(i think it is called text:) and do some implemetations on the results.. I have to use, for example, the message object and its status value, if status equals to 1 i will trigger a Notification in my App. As like that, if the button comes me as a value with 1 i will send a POST to the server and request for the button id and title attributes.. </p> <p>There are a lot of tutorials about parsing but all i saw are about Twitter or flickr APIs, unfortunately i couldnt desing a clear way to solve my problem.. I tried <a href="http://allseeing-i.com/ASIHTTPRequest/" rel="nofollow">ASIHTTPRequest</a> but i faced some problems with setting up the Libraries. And if i'm not wrong, ASIHTTPRequest is not such a good idea in i-OS 5 (i m not sure about this).. Anyway, from this point can anyone please help me about how to parse the JSON above? </p> <hr> <p>Finaly i figured out, i have done everything before, i just realized that.. for example when i tried:</p> <pre><code>NSString*key1=[ result objectForKey:@"key" ]; NSString *kAndVal=[result objectForKey:@"button"]; NSLog(@"\n%@ : %@", key1, kAndVal); </code></pre> <p>i got the key and button values above.. I hope this answer will save lots of newbies like me out of trouble..</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload