Add handling 404, and 500 in JSON