Tuesday, May 24, 2011

JSON parsing in iphone

JSON (JavaScript Object Notation) is a lightweight data-interchange format .But how do i parse json in iphone,its fairly simple thanks to the json-framework http://code.google.com/p/json-framework/
Steps Required
1.Download the library from the above link.
2.In your project Drag and drop the JSON folder from the downloaded folder.Check the option copy folders.
3.Import JSON.h to the file where you want to do the json parsing.
Now for the parsing its fairly simple
If your json Format is an object then you can parse directly

NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

NSDictionary *results = [jsonString JSONValue];

NSString *studentsAge=[results objectForKey:@"age"];


Depending on your object you have to adjust the result variable data type and You were done.





Thursday, January 20, 2011

Creating a color picker in mac os-x

Color picker a utility you require most often if you are a designer or a web programer.But Apple made very easy to create one with just one line of code.
This are the steps to create a color picker in mac os-x.
1.Open Apple script Editor.
2.Type "Choose color"
3. Save the file as a application.
And you are just done with it,this is the power of mac.Is in it the amazing thing if you are a developer