title: Posting JSON to a Webservice "Invalid JSON Primitive"
body: <p>I've been searching for hours to a solution to this problem, and I can find nothing that solves my issue.  I receive <code>Invalid JSON Primitive</code> whenever I attempt to send a URL with a string value (NSString) in it to my server via an HTTP Get.</p>
  
  <p>My code:</p>
  
  <p><code>Client Side Obj-C</code></p>
  
  <pre><code>- (void) createRequest: (NSString*)urlFormatted {
  
      NSURL *url = [NSURL URLWithString: urlFormatted];
      NSMutableURLRequest *request =[NSMutableURLRequest requestWithURL: url];
  
      [request setHTTPMethod:@"GET"];
      [request setValue:@"application/json; charset=UTF-8" forHTTPHeaderField:@"Content-Type"];
      _webData = [[NSMutableData data] retain];
      _connection = [[NSURLConnection alloc] initWithRequest:request  delegate:self];
  }
  
  
  -(void) authenticate:(NSString*) userName password:(NSString*)password
  {
      NSString*url = @"http://service.example.com/service.asmx/Test?test1=hi";
      [self createRequest:url];
      [url release];
  }
  </code></pre>
  
  <p><code>Server Side C#</code></p>
  
  <p>This does not work. Whenever I have a string as a parameter, I receive the message,</p>
  
  <p><code>Invalid JSON Primitive</code> e.g.</p>
  
  <pre><code>[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
  public string Test(string test1)
  {
     return "Ok.";  // For testing purposes, just return a string.
  }
  </code></pre>
  
  <p>This however, works fine.  (Obviously if I change my test1 parm to an integer)</p>
  
  <pre><code>[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
  public string Test(int test1)
  {
     return "Ok.";  // For testing purposes, just return a string.
  }
  </code></pre>
  
  <p>Everything I have read points me to ensure that I have <code>application/json</code> set - which it is. Whenever I <strong>don't use strings</strong> in my URL, everything is fine.  I don't understand why this doesn't work.  It doesn't looking like an encoding issue to me. Any ideas?</p>