Am writing one small application to parse from XML to JSON object for iphone. can anyone tell me the availability of open source library present to do the parsing usnig objective-c.
问题:
回答1:
There are plenty of open source solutions in objective-c to deal with JSON :
- JSONKit : https://github.com/johnezang/JSONKit
- SBJson (aka json-framework) : https://github.com/stig/json-framework
- YAJL Framework : https://github.com/gabriel/yajl-objc
To deal with xml, you can use the default NSXMLParser class or some other solutions like some code I've posted here (DOM parser) : NSXMLParser retrieving wrong data from XML tags
You can also check this page which will give you a good overview of available solutions for XML parsing (and an explaination of differences between SAX and DOM parsers) : http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project
回答2:
Well there is a json parser available for objective c on github. Its very simple to use. You may have to write some additional code to provide input to the parser.
回答3:
I use NSPropertyListSerialization from Apple to turn a Plist XML into a dictionary. Then we just need to find something to go from dictionary to JSON.
The json-framework looks like a nice JSON generator.