Type for "status" member of Error Object


JSON API specification says that status member of Error Object should be expressed as string value. HTTP specification says that “The status-code element is a three-digit integer code […]” (https://tools.ietf.org/html/rfc7231).

Wouldn’t it be better if the return value of status member in JSON API return int value?


Usually in programming an int is used when you want to do mathematical operations and a string in used when that number is more like a symbol. For example, status codes or a player’s jersey number. I might be wrong.


I think that status-code is not like a symbol, because there is some logic, like 2xx are success codes and 5xx are server errors. So, sometimes you need to do some mathematical comparison.

I understand, that you can check first character of string, but programming languages use int values.
For example Java class HttpServletResponseWrapper uses int as argument for setStatus().
C# HttpResponse.StatusCode set/get int value.
PHP has method http_response_code() which accepts int as status code.

So, if implementation of JSON API returns string value (as required by specification), I need to convert it to int value to send response to client.