在iOS中解析JSON与解析XML

在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.

问题:

  1. 是否有任何理由选择其中一种而不是另一种?
  2. 解析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.