I am trying to understand which data format is better on embedded device communicating with Server over REST API. XML or JSON?. Is JSON parsing faster than XML parsing in Java / C and C++? I understand for web client JSON is way to go since java script has inbuilt support for JSON but not sure about embedded device(Java/C/C++).
XML is probably better if you need to do something with the message beyond simply deserializing it (e.g., if you need to pull some routing or processing information out of it with an XPath expression). XML can give you some additional validation tools (like schema validation), and may make more sense if messages need to be archived and potentially processed again later. But if all you need is a transport format, you may be better off sticking with JSON, especially if the bulk of your processing work is going to be done on the client.
If the content has a lot of tags and not much content, JSON is better for the network because the size of the messages will be smaller. Now if the reverse is true, lots of content and not a lot of tags, JSON loses it's message size advantage somewhat, because regardless there is a large message coming across.
I am not sure about the parsing. I would load up the same XML/JSON sample data that the application would be using and run them through the parsers you are planning on using and see which one performs better.
If the parsers you are using load the XML/JSON into an object model of some sort, the performance should be about equal, but a quick test should prove if there is any real difference in parsing speed.