springboot 框架,返回前段 json对象时,前段接收到的对象是一个字符串。 JSON 中的 MAP 是不支持 int 为 key 的; Map<Integer, String> map = new HashMap<>(); map.put(1, "one"); map.put(2, "two"); System.out.println(JSON.toJSONString(map)); {1:“one”,2:“two”} 标准的json规范中,要求对象的key必须为string