2

I am currently consuming OData in a Xamarin App - and there is a significant performance issue on devices older than the iPhone 5. I believe it is because a simple request returns a significant amount of Xml - which has to be parsed by the phone. Using Json cuts the payload size to 1/10th.

(note: I am referring to the fact it will reduce the amount of work that the client library has to do, not the fact it will transfer over the network more quickly)

How can I turn on Json in Simple.OData? Xml is basically unusable on iPhone 4.

Thanks

Adam
  • 4,159
  • 4
  • 32
  • 53
  • I've since pulled out the Simple.OData for making the actual request, and now just use RestSharp.MonoTouch. I still use Simple.OData for formulating the request URI - so that I can keep using all my Linq queries... I just dont actually execute it - I grab the URI from GetCommandTextAsync, and pass that to ReshSharp. Increased my App's performance 10x! I will, however, eagerly await Simple.OData json support... – Adam Jun 21 '14 at 21:38

2 Answers2

2

JSON support has been added to Simple.OData.Client 4.0. It should work fine now.

Vagif Abilov
  • 9,835
  • 8
  • 55
  • 100
  • Hi Vagif, do you have any idea of the following question: http://stackoverflow.com/questions/29497535/adding-jsessionid-in-request-header – casillas Apr 07 '15 at 19:40
  • How do you enable that? I'm getting an XmlException when querying with SOC, saying `System.Xml.XmlException: 'Data at the root level is invalid. Line 1, position 1.'`. ([StackTrace](https://zerobin.net/?699886c22b165924#q0yqNyoOZSVmZPgzSf8qMBykLxaVm88+X/Cto9Skf1k=)) – Shimmy Weitzhandler Jul 30 '19 at 04:36
0

According to OData Protocol, add the following in http header will enable server using Json format: Accept:application/json

Or add the $format in url like following:

BaseUrl\Customers?$format=application/json

Maya
  • 816
  • 6
  • 5
  • Please note the specific question "How can I turn on Json in Simple.OData". Simple.OData needs to not only ask the server for Json, but be able to understand, and parse the response. – Adam Jun 19 '14 at 04:57