Question: What is the best practice to return some error codes like **400, 412, 402** etc. ?  

Can I return some kind of JSON if I'm creating restfull api ?   
For example, if I send request *POST .../cars/1* and I get 402 then should or could server return to me some kind of JSON if i need data? and I do not want to increase traffic on server too much.

tl;dr:  

Should/could restfull api return data when server send error code for example **4XX [without 404]**

Answer: 
It should reply with that code [STATUS](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) so any client can understand it. 

And then a good pratice is to check the [Accept header](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html) sent by the client and reply a response encoded with any of the supported format. So for example the client has *application/javascript* It seems that it is expecting that format.
you make your response object and send status in that 
for example.
{
"status":400,
data:{
"error":"this is error response",
"isSuccess":true
}
}
and send response status in response