Fix off-by-one error in json/convert/to_enum