在iOS中解析JSON与解析XML [英] Parsing JSON vs parsing XML in iOS
本文介绍了在iOS中解析JSON与解析XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
场景:
我正在研究一个解析器,该解析器用于在发出请求后从服务器发送回的数据.数据格式为JSON或XML.
I am working on a parser for data which is sent back from a server after making a request. The format of data is either JSON or XML.
问题:
- 是否有任何理由选择其中一种而不是另一种?
- 解析json或解析xml哪个更快?
谢谢.
推荐答案
Checkout this tutorial about parsing XMLs. I might sound opinionated, but if there's a choice go for JSON, although I have no clue what situation your project is in. I would certainly look at the entire architecture (trade-offs and choices) of the project before making a decision. From my experience, understanding JSON and relating it to NSDictionaries and NSArrays is much easier than understanding XMLs.
这篇关于在iOS中解析JSON与解析XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文