views:

402

answers:

0

This question is a follow up to @joshperry's answer on CustomQueryStringConverter. I implemented this solution with a small modification. My version converts System.Int32[] instead of string[].

However, I have a problem with my WCF configuration. My service dishes out SOAP, XML and JSON. SOAP wasn't a problem, this solution works for XML, but JSON is still messed up. I tried found out that the class that does JSON conversion automatically (enableWebScript behavior) is a sealed class, so I can't override it like you did for WebHttpBehavior. I also tried adding two behaviors, but that didn't work either:

    <behaviors>
      <endpointBehaviors>
        <behavior name="xmlBehavior">          
          <ArrayQuerystring />
        </behavior>
        <behavior name="jsonBehavior">                    
          <ArrayQuerystring />
          <enableWebScript />
        </behavior>
      </endpointBehaviors>      
    </behaviors>

I think it might be an ordering issue? If I put the ArrayQuerystring behavior first, I get no results. If I put it second, then I get the same results as the XML endpoint. How do I apply your CustomQuerystringConverter to a JSON endpoint?