Skip to content Skip to sidebar Skip to footer

Android, Problems Parsing Json Returned By A 422 Response

My web server responds with a 422 unprocessable entity error and renders a json response with a list of the errors e.g. {'name':['has already been taken']} For some reason though

Solution 1:

Well i think that you need to specify a header like this:

HttpPosthttppost=newHttpPost(url);
httppost.setHeader("Accept", "application/json");
httppost.setHeader("Content-type", "application/json");

Solution 2:

After re-booting my PC The problem just went away. I am really puzzled by this whole episode. I was convinced my code was right and the log output was proving it wasn't. I can only put this down to some totally unfathomable caching issue.

A big thank you to those that helped.

Post a Comment for "Android, Problems Parsing Json Returned By A 422 Response"