Does anyone know of a library that will convert XML to JSON in objective C (on the iPhone)?
Thanks in advance,
Rob
Does anyone know of a library that will convert XML to JSON in objective C (on the iPhone)?
Thanks in advance,
Rob
I know it's not exactly what you want, but here is an article for a JSON library on the iPhone.
http://iphonedevelopertips.com/cocoa/json-framework-for-iphone-part-2.html
Combine that with this tutorial on reading XML on the iPhone and with a little elbow grease, you can create your own xml to JSON converter. As I said, not exactly what you wanted, but I hope it helps.
http://www.iphonesdkarticles.com/2008/11/parsing-xml-files.html
Is there a particular reason why you require XML converted to JSON?
At the end of the day, they both represent the same data - and I assume the data is what is important here.
If you have data represented in XML that needs to be posted to a server that only accepts JSON, then I understand why you'd need a converter, but consider this first:
Parse the XML into native Foundation objects (NSDictionary, NSArray, NSString, NSNumber, etc.). Then use a JSON library such as JSON-Framework to write the Foundation objects into a JSON representation.
The same could be done if downloading XML. Although if you're downloading XML, I don't understand why you'd need to convert it into JSON before parsing it?