How to specify dataType: 'json' in Angular.js $http.post?

I would like to specify dataType: 'json' as in conventional jQuery $.ajax. Is this possible with Angular.js $http.post ?

You can use the HTTP Config object to set the headers:

$http({
    method: 'POST',
    url: 'somewhere.xyz',
    headers: {
        'Content-type': 'application/json'
    }
})

From http://docs.angularjs.org/api/ng.$http

Transforming Requests and Responses Both requests and responses can be transformed using transform functions. By default, Angular applies these transformations:

Request transformations:

  • if the data property of the request config object contains an object, serialize it into JSON format. Response transformations:

  • if XSRF prefix is detected, strip it (see Security Considerations section below)

  • if json response is detected, deserialize it using a JSON parser

So no need to set a data type it is done automatically