I am using jersey with springboot. Below is my code and response i get.
Code:
@Component
@Path("/books")
public class BookController {
@GET
@Produces("application/json")
public Map getAllBooks() {
Map jsonObject = new HashMap<>();
jsonObject.put(1,1);
jsonObject.put("2","string2");
return jsonObject;
}
}
Response in chrome browser :
{"1":1,"2":"string2"}
As you can see, the first object's key is an integer but it shows as string in the browser. how to display the key as an integer in the browser.