Fixing build error by moving the json error moving back to controller