title: how to pass json string and deserialize in WCF
body: <p>I am having a json string </p>
  
  <pre><code>json1 = "{\"Shops\":[{\"id\":\"1\",\"title\":\"AAA\"},{\"id\":\"2\",\"title\":\"BBB\"}],\"movies\":[{\"id\":\"1\",\"title\":\"Sherlock\"},{\"id\":\"2\",\"title\":\"The Matrix\"}]}";
  </code></pre>
  
  <p>want to deserialize and get values in two classes shops and movies inside requestcollectionclass.</p>
  
  <pre><code> [WebInvoke(
                 Method = "POST",
                 UriTemplate = "SubmitRequest",
                 RequestFormat = WebMessageFormat.Json,
                 ResponseFormat = WebMessageFormat.Json
                 )
          ]
    string SubmitRequest(string RequestDetailsjson);
  </code></pre>
  
  <p>and in the service.cs </p>
  
  <pre><code>JavaScriptSerializer serializer = new JavaScriptSerializer();
              RequestDetailsCollection requestdetailscoll = serializer.Deserialize&lt;RequestDetailsCollection&gt;(RequestDetailsjson);
  </code></pre>
  
  <p>Getting error</p>
  
  <blockquote>
    <p>The server encountered an error processing the request. The exception message is 'There was an error deserializing the object of type System.String. End element 'root' from namespace '' expected. Found element 'request' from namespace ''.'. See server logs for more details. The exception stack trace is:</p>
  </blockquote>
  
  <p>I changed the parameter type to stream </p>
  
  <pre><code>string SubmitRequest(Stream RequestDetailsjson);
  </code></pre>
  
  <p>And changed the code</p>
  
  <pre><code>StreamReader sr = new StreamReader(RequestDetailsjson);
  JavaScriptSerializer serializer = new JavaScriptSerializer();
  RequestDetailsCollection requestdetailscoll = (RequestDetailsCollection)serializer.DeserializeObject(sr.ReadToEnd());
  </code></pre>
  
  <p>And getting error</p>
  
  <blockquote>
    <p>The server encountered an error processing the request. The exception message is 'Incoming message for operation 'SubmitRequest' (contract 'IService1' with namespace '<a href="http://tempuri.org/" rel="nofollow">http://tempuri.org/</a>') contains an unrecognized http body format value 'Json'. The expected body format value is 'Raw'. This can be because a WebContentTypeMapper has not been configured on the binding. See the documentation of WebContentTypeMapper for more details.'. See server logs for more details. The exception stack trace is:</p>
  </blockquote>
  
  <p>Help me to resolve this issue</p>