在运行URI时从rest服务获取重复值输出

时间:2018-05-10 16:51:14

标签: java rest web-services

package Book;

import java.util.ArrayList;
import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/resrtest")
public class Test {

    @GET
    @Produces({MediaType.APPLICATION_JSON})
    public Student datareturn() {
        Student student = new Student();
        student.setName("ram");
        student.setAge(29);
        student.setSection("A");
        student.setRoll(11);
        student.setFathername("sam");
        student.setSchoolname("ANC");

        return student;
    }
}

输出:

  

{"名称":"夯""辊":11,"年龄":29," fathername&# 34;:" SAM""名称":"夯""辊":11," schoolname&#34 ;: " ANC""节":" A"}

为什么Name和Roll会重复?

0 个答案:

没有答案