[Mono-aspnet-list] Mono JsonSerializer exception parsing jQuery JSON

Uli Hertlein uli at xdt.com.au
Mon May 9 21:12:51 EDT 2011

Hi guys,

I've been banging my head on this problem getting an ASP.Net/WCF/JSON application to work with Mono 
2.10.2 for a while now, so any ideas are appreciated.

The problem is that jQuery is sending a POST with a JSON body that looks like:


This is throwing an exception in xsp4 (with MONO_STRICT_MS_COMPLIANT=yes)

Exception Expected element was 'd', but the actual input element was 'hostUrl' in namespace ''
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject (System.Xml.XmlReader 
reader, Boolean verifyObjectName) [0x00000] in <filename unknown>:0

Sending the same request to .Net works.

The service interface/implementation looks like this:

     public interface IManagementService
         MountPoint[] GetMountPoints(string hostUrl);

     public class ManagementService : IManagementService
         [WebInvoke(Method="POST", BodyStyle=WebMessageBodyStyle.WrappedRequest, 
         public MountPoint[] GetMountPoints(string hostUrl)
             // ...

FWIW: When I do a manual GET request with the same parameters I get properly formatted JSON back 
(with the 'd' container):

     wget http://localhost:8080/Services/ManagementService.svc/GetMountPoints?hostUrl=localhost


Ulrich Hertlein
Research and Development   mailto:uli at xdt.com.au
XDT Pty Ltd                http://www.xdt.com.au

More information about the Mono-aspnet-list mailing list