Fixed if/else statements which input incorrect values into the json object being passed to front end