-1

I'm manipulating few data with PHP, I have the choice between JSON and XML. But I don't know what to choose, I have worked with PHP in my codeigniter application. Now i want to manipulate a Web Service for android application. My friends who are php developers say JSON is better for Web Applications While friends who are android developers say that XML is better for mobile applications because JSON might be reason for application crashing, I am confused please help to select

Jitesh Tukadiya
  • 1,225
  • 1
  • 11
  • 24
  • 4
    "While friends who are android developers say that XML is better for mobile applications because JSON might be reason for application crashing, I am confused please help to select." --- Wow, that is quite the statement. Besides being incredibly wrong, it's trivial to challenge it simply by asking "Why" – Thomas Dignan Mar 12 '13 at 08:38
  • JSON might be the reason for application crashing? How ? – Anukool Mar 12 '13 at 08:41
  • @Anukool i dont know why but my friends told me that thing. – Jitesh Tukadiya Mar 12 '13 at 08:43
  • Exactly depends on you. In case of XML, you need to override some of the callbacks methods like elements(...) ets. But in case of JSON you can easily get the content during creation of the JsonObject. So json procedure is simpler than the XML. That may be the only reason that the developer goes to json side. – Maddy Mar 11 '14 at 07:00

5 Answers5

5

I think that right asnwer for you does not exist. It depends on you what you will choose, on character of application and with whose data format you prefer to work. Also get experience from other Android developers.

I'm using both because for some reason is better choice JSON, for another XML.

Here is nice thread about pros and cons of XML and JSON.

Community
  • 1
  • 1
Simon Dorociak
  • 33,095
  • 10
  • 66
  • 104
2

I'd go with JSON, as it is smaller is size than XML and faster to process.

vivek
  • 1,904
  • 1
  • 17
  • 26
0

In my experience XML is more cumbersome to parse on Android than JSON. However, it is a matter of preference more than anything else. Ask your Android developer what she prefers and then do it like that.

Shade
  • 9,755
  • 5
  • 55
  • 84
0

JSON web services is light weight and XML and SOAP web services are heavy weight. Json should be first priority.

Amit Gupta
  • 8,774
  • 1
  • 23
  • 33
0

JSON is very easy to parse. I am developing apps too and i was also confused with XML and JSON. I am using JSON right now and its works very well without any crashes. You just have to surround your code with try/catch block and you can easily catch JSONException if there is any.

Akash Shah
  • 154
  • 1
  • 11