Use Content-Type "application/json" when posting JSON to Google App Engine

24th June 2011

If you are sending a JSON POST body to App Engine, make sure you set the Content-Type request header to application/json otherwise the post body will not be decoded correctly on the Google App Engine side.

Using ASIHTTPRequest:


	NSURL *url = [NSURL URLWithString:@"http://example.com/"];
	ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
	[request addRequestHeader:@"Content-Type" value:@"application/json"];
	[request appendPostData:[@"{\"count\" : 49}" dataUsingEncoding:NSUTF8StringEncoding]];