here is incorrect string comparison. please replace json == "" to the expression json.length() == 0 or to json.equals("")