3

My iPhone app communicates with a RESTful service that provides JSON output. I've been generating JSON using mainly PHP. If I use a .NET web service or WCF service, will there be any limitations or differences I should be aware of in regards to JSON as input/output for the service? I'm not sure what to expect from .NET in this regard.

user230949
  • 1,109
  • 2
  • 16
  • 22

1 Answers1

1

One thing I noticed: .NET emits DateTime objects as

 \/Date(xxxx)\/

where xxx is the number of seconds or whatever. I had to eval that on the JAvascript side to get it to become an actual date.

Cheeso
  • 189,189
  • 101
  • 473
  • 713
  • Thanks. Other than the date, you believe there probably isn't much to be concerned about? – user230949 Jan 18 '10 at 22:51
  • JSON is just JSON, right? Have you ever written a WCF service? That's probably the biggest hurdle. – Cheeso Jan 18 '10 at 23:26
  • 1
    see this example for a good start on a basic WCF service that emits JSON http://stackoverflow.com/questions/2086666/wcf-how-do-i-return-clean-json/ – Cheeso Jan 18 '10 at 23:44
  • Thanks. That's a very good resource. Do you know of any issues on the input side? Meaning, am I OK to send JSON to the WCF service without having to do anything special? – user230949 Jan 19 '10 at 04:30
  • No special requirements on the input side. You can send complex objects to WCF, too. For some suggestions on that, see this answer: http://stackoverflow.com/questions/2062053/passing-complex-objects-into-a-wcf-rest-service/2062143#2062143 – Cheeso Jan 19 '10 at 05:03