WCF REST: Return JSON or XML for access by multiple clients?
Can anyone tell me what the preferred method for the content type is?
i.e. what is best to return JSON or XML?
The clients that will be accessing my service will vary, silverlight, iphone, android, WPF and WP7.
I am stuck betw开发者_Go百科een stick with the default - xml or returning JSON?
DOes anyone have the pros and cons for each when talking to multiple clients
Thanks in advance
Here are some pros and cons off the top of my head...
JSON has the following advantages over XML:
- Much easier to consume in web browser clients because it's Javascript-based.
- Data format is more compact, especially if you have a lot of data elements.
XML has the following advantages over JSON:
- Better support in non-Javascript environments.
- Structure can be formally defined and validated through an XML schema.
精彩评论