Processing JSON output in iOS - objective-c

I made a very simple wordpress plugin that prints some posts in JSON format. I was wondering what is the best and simplest way is to process that information in Xcode.
I've seen many examples and many frameworks but I would like to hear your opinion and maybe some example code?
Thank you.

If you are targeting iOS 5.0 and later, the simplest way is using the NSJSONSerialization class that Apple provides.

As rob said if you're targeting iOS 5 use Apples NSJSONSerialization class. For earlier iOS versions there area also some options:
JSONKit (fastest)
SBJson
and others ...

Related

ObjC, Swift to WinObjC

I have an iOS app which includes both objective c and swift. Does the winobjc tool support converting the iOS apps which includes both objective c and swift code?
I work on the Windows Bridge for iOS at Microsoft. We're getting more and more questions about Swift support and it's clearly a top priority for the community. Now that Apple has open sourced large parts of Swift, we're considering our options and the technical implications of implementing it.
We regularly update our roadmap on our project wiki with our plans for the next month or two, so there is the best place to check for near-term plans. If you try out the bridge and have any questions, please don't hesitate to get in touch by filing an issue on Github. Thanks for checking out the bridge!
No, WinObjC only supports Objective-C but no Swift at this point.
It also doesn’t seem to be on their roadmap at this point.

ASIHTTP equivalent for OSX

Im looking to upload xml files to a php server that range from 1mb to 50mb. As far as I can tell ASIHTTP was the code to use back in the day but Im looking for a newer framework to work with.
The ASIHTTP website recommended AFNetworking, but I was wondering if there were any other good ones out there I should look into. Im VERY new to cocoa programming and have started off learning with ARC enable so something compatible with that would be ideal also.
https://github.com/AFNetworking/AFNetworking/
Right now AFNetworking is the best choice. I've used it and it's pretty good. I recommend it!
If you're looking at recommendations that are a few years old suggesting you use a third party library, you might consider taking a second look at what the OS itself provides. NSURLConnection still isn't the best solution for everyone, but it's improved much over the last few iOS & OS X releases.

JSON parser for Cocoa

I'm starting with iOs. I'd like to know if there is a built-in JSON parser and , if not, what is the best alternative for mapping JSON string into Cocoa objects.
Thanks
If you are targeting iOS 5 only, then there is the built-in NSJSONSerialization class that will do the job nicely. If you need it to work in older versions of iOS, then something like SBJSON works well for me
There is a built in JSON parser (NSJSONSerialization) in iOS 5 and above.
If you want to target earlier versions of iOS, there are many third party ones such as TouchJSON.
Have you looked at JSONKit
JSONKit
JSONKit is dual licensed under either the terms of the BSD License, or alternatively under the terms of the Apache License, Version 2.0.
Copyright © 2011, John Engelhart.
A Very High Performance Objective-C JSON Library
UPDATE: (2011/12/18) The benchmarks below were performed before Apples NSJSONSerialization was available (as of Mac OS X 10.7 and iOS 5). The obvious question is: Which is faster, NSJSONSerialization or JSONKit? According to this site, JSONKit is faster than NSJSONSerialization. Some quick "back of the envelope" calculations using the numbers reported, JSONKit appears to be approximately 25% to 40% faster than NSJSONSerialization, which is pretty significant.
I use SBJson , it is not a built-in JSON parser, but I recommand it, you can try it.

How to get and parse JSON using objective C?

Is it possible to get and parse JSON using objective C, then manipulate it within the cocoa framework for the iphone/pad? I'm specifically looking to do this for a couple of public APIs out there.
See here: how to do json parsing in iphone
Basically, you should look into the TouchJSON library (with CJSONDeserializer and CJSONSerializer).
Used Json-framework on some previous projects, worked really well.
EDIT: I read your post a bit too fast. I've used it on a Mac app before but not targeting the iphone/ipad. I think it should work but have no background to it. Maybe someone else can confirm?
It's not only possible, it's dirt simple if you use one of the many existing open source projects dedicated to this task. I recommend trying yajl-objc, which offers a streaming parser, but json-framework is a good one too. They're very similar.
I'd stay away from TouchJSON, since it gave me trouble a while back with special characters (line breaks) in strings.
However, I'll join the choir recommending json-framework. Since I switched to that from TouchJSON everything's been running smoothly.
Regarding how to integrate the API in your project, they're equally simple to include and use.
As a side note, I'm just now testing out JSONKit, since it's supposed to be much faster than both TouchJSON and json-framework. However, I can't vouch for its stability yet. The reviews of it are good, though.
If you're developing an application that is only iOS 5.0 or later, you can use NSJSONSerialization.

Cocoa/Objective-C - Can i somehow see the implementation files?

I believe i can learn thing or two if i can see the implementation files (.m files). Is there any way the i can view NSString.m or NSNumber.m files? and others? If i try to find these files using spotlight, i get nothing.
No, most (all?) of the Cocoa library implementations are only distributed in a compiled binary form. You could disassemble them, but that's probably against the Mac OS X EULA, and it also wouldn't help you understand them at all.
You could take a look at Cocotron, which is an open-source implementation of Cocoa. It won't be exactly the same, but at least for the core classes, it will be virtually identical.
Many of the basic cocoa classes, like NSString and NSNumber, are implemented in core foundation and "toll-free bridged" to objective-c classes. Core foundation is a C (not ObjC) API and the source is available as part of the Darwin open-source project.
So, to see how NSString or NSNumber is implemented under the hood, follow the link above and take a look at CFString and CFNumber, respectively (you'll need an Apple developer account, but registration is free).
Also worth looking at the mySTEP sources.
This helped me when doing something that subclassed NSMatrix some time ago.
I would guess they are already compiled into libraries.
I just did a quick check on my mac and could not find a NSString.m file as well. Are you utilizing Xcode's documentation? I find it has most everything I need.