Changed JSON check to 400 error

Malformed JSON should return 400 instead of 500 error